Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. int main(void)
  2. {
  3. DDRA=0xFF;
  4. DDRB=0x00;
  5.  
  6. //unsigned char i;
  7. //lcd_init(LCD_DISP_ON);
  8. //lcd_clrscr();
  9.  
  10. //lcd_puts("LCD test ...");
  11. //lcd_gotoxy(2,1);
  12. //lcd_putc(50);
  13.  
  14. // InitADC();
  15. // DDRD=0xFF;
  16.  
  17. //PORTD&=~_BV(2);
  18. //PORTA|=_BV(1);
  19.  
  20. // PWMinit();
  21.  
  22. while(1)
  23. {
  24. //Aici se scrie programul!!!!!!!
  25. /*PORTA |= _BV(1);
  26. PORTA &= ~_BV(1);
  27. _delay_ms(1000);*/
  28.  
  29. /*PORTA ^= _BV(1);
  30. _delay_ms(1000);
  31.  
  32. PORTA ^= _BV(1);
  33. PORTA ^= _BV(2);
  34. _delay_ms(1000);
  35.  
  36. PORTA ^= _BV(2);
  37. PORTA ^= _BV(3);
  38. _delay_ms(1000);
  39. PORTA ^= _BV(3);
  40.  
  41.  
  42. PORTA ^= _BV(2);
  43. _delay_ms(1000);
  44. PORTA ^= _BV(2);*/
  45.  
  46.  
  47. if(_BV(7) & PINB)
  48. PORTA &= ~_BV(1);
  49.  
  50. else
  51. {
  52. PORTA |= _BV(1);
  53. _delay_ms(1000);
  54. PORTA &= ~_BV(1);
  55. _delay_ms(1000);
  56. }
  57.  
  58. if(_BV(6) & PINB)
  59. {
  60. PORTA &= ~_BV(1);
  61. PORTA &= ~_BV(2);
  62. }
  63.  
  64. else
  65. {
  66. PORTA |= _BV(1);
  67. PORTA |= _BV(2);
  68. _delay_ms(1000);
  69. PORTA &= ~_BV(1);
  70. PORTA &= ~_BV(2);
  71. _delay_ms(1000);
  72. }
  73.  
  74. if(_BV(5) & PINB)
  75. {
  76. PORTA &= ~_BV(1);
  77. PORTA &= ~_BV(2);
  78. PORTA &= ~_BV(3);
  79. }
  80.  
  81. else
  82. {
  83. PORTA |= _BV(1);
  84. PORTA |= _BV(2);
  85. PORTA |= _BV(3);
  86. _delay_ms(1000);
  87. PORTA &= ~_BV(1);
  88. PORTA &= ~_BV(2);
  89. PORTA &= ~_BV(3);
  90. _delay_ms(1000);
  91. }
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98. //ret_val = ReadChannel(0);
  99. //DisplayReading(ret_val);
  100.  
  101. // set_pwm_val(0x1FF);
  102. // PORTD=0x10;
  103.  
  104.  
  105. }
  106. return 0;
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement