Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <mega8.h>
- #include <stdio.h>
- char USARTReadChar()
- {
- while(!(UCSRA & (1<<RXC)));
- return UDR;
- }
- void USARTWriteChar(char data)
- {
- while(!(UCSRA & (1<<UDRE)));
- UDR=data;
- }
- char data;
- void main(void)
- {
- USARTWriteChar(data);
- if(data=='F')
- PORTB=0b00001010;
- else if (data=='B')
- PORTB=0b00000101;
- else if (data=='L')
- PORTB=0b00000010;
- else if (data=='R')
- PORTB=0b00001000;
- else if (data=='S')
- PORTB=0b00000000;
- else
- PORTB=0b00110000;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement