Advertisement
Guest User

Untitled

a guest
May 5th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <mega8.h>
  2.  
  3.  
  4. #include <stdio.h>
  5.  
  6. char USARTReadChar()
  7. {
  8. while(!(UCSRA & (1<<RXC)));
  9. return UDR;
  10. }
  11. void USARTWriteChar(char data)
  12. {
  13. while(!(UCSRA & (1<<UDRE)));
  14. UDR=data;
  15. }
  16. char data;
  17.  
  18. void main(void)
  19. {
  20.  
  21. USARTWriteChar(data);
  22.  
  23. if(data=='F')
  24. PORTB=0b00001010;
  25. else if (data=='B')
  26. PORTB=0b00000101;
  27. else if (data=='L')
  28. PORTB=0b00000010;
  29. else if (data=='R')
  30. PORTB=0b00001000;
  31. else if (data=='S')
  32. PORTB=0b00000000;
  33. else
  34. PORTB=0b00110000;
  35.  
  36.  
  37. }
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement