Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1.  
  2.  
  3. #include <avr/io.h>
  4. #include <util/delay.h>
  5. #include <avr/interrupt.h>
  6. #include "hd44780.h"
  7. #include <stdlib.h>
  8. #include <avr/pgmspace.h>
  9. #include <string.h>
  10.  
  11. #include "myuart/myuart.h"
  12. #include "MK_TERMINAL/mk_term.h"
  13.  
  14.  
  15.  
  16.  
  17.  
  18. int main()
  19. {
  20. DDRD = 0xFF; // led
  21. PORTD = 0x00;
  22.  
  23.  
  24. uart_init( __UBRR );
  25.  
  26.  
  27. sei(); /* globalne zezwolenie na przerwania */
  28.  
  29.  
  30.  
  31. while(1)
  32. {
  33.  
  34. }//koniec while(1)
  35.  
  36.  
  37. }//koniec main
  38.  
  39. ISR( USART_RXC_vect ) // bt
  40. {
  41. char zmienna = UDR; // rejestr, w którym zapisujemy odebrany znak
  42. if (zmienna == 'a') // on
  43. {
  44. PORTD = 0x01;
  45. }
  46. if (zmienna =='b') // off
  47. {
  48. PORTD = 0x00;
  49. }
  50.  
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement