Advertisement
Hafixie93

Zero movement

Dec 7th, 2020
622
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // 0 pergerakan
  2.  
  3. #include <mega32.h>
  4. #include<delay.h>
  5. void main(void)
  6. {
  7. // Declare your local variables here
  8. // Port A initialization
  9. DDRA=0xFF; // Selector
  10. // Port B initialization
  11. DDRB=0xFF; // Data
  12. while (1)
  13. {
  14. // Place your code here
  15. PORTA=0b11111110; // number ‘4’ 7-segment is ON
  16. PORTB=0b01100110; // digit ‘8’
  17. delay_ms(50);
  18.  
  19.  
  20. PORTA=0b11111101; // number ‘4’ 7-segment is ON
  21. PORTB=0b01100110; // digit ‘8’
  22. delay_ms(50);
  23.  
  24. PORTA=0b11111011; // number ‘4’ 7-segment is ON
  25. PORTB=0b01100110; // digit ‘8’
  26. delay_ms(50);
  27.  
  28. PORTA=0b11110111; // number ‘4’ 7-segment is ON
  29. PORTB=0b01100110; // digit ‘8’
  30. delay_ms(50);
  31.  
  32. }
  33. }
Advertisement
RAW Paste Data Copied
Advertisement