Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unsigned char varTransmis;
- unsigned char varPrimit;
- void setup() {
- UBRR0 = 104;
- UCSR0A = 0;
- UCSR0B |= (1<<TXEN0) | (1<<RXEN0);
- UCSR0C |= (1<<UCSZ01) | (1<<UCSZ00);
- }
- void USART_send_one_character(unsigned char data)
- {
- while(!(UCSR0A&(1<<UDRE0)));
- UDR0=data;
- }
- unsigned char USART_receive()
- {
- while(!(UCSR0A & (1<<RXC0)));
- return UDR0;
- }
- void loop()
- {
- varPrimit = USART_receive();
- USART_send_one_character(varPrimit);
- delay(500);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement