Advertisement
NB52053

Untitled

Jul 2nd, 2019
1,636
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <mega32.h>
  2. #include<delay.h>
  3. // Declare your global variables here
  4. void main(void)
  5. {
  6. // Declare your local variables here
  7. DDRC = 0b00001111; // pin 3 of Port C is set as Output
  8. DDRB = 0b00000000; // pin 0, 1, 2, 3, 4, 5, 6, 7 of Port B is set as Input
  9. while (1)
  10. {
  11. // Place your code here
  12. if (PINB.5 == 0)
  13. {
  14. PORTC = 0b00001111; // pin 3 of Port C voltage is High
  15. delay_ms(200);
  16. }
  17. else
  18. {
  19. PORTC = 0b00000000; // pin 3 of Port C voltage is Low
  20. delay_ms(200);
  21. }
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement