Advertisement
Guest User

Tonoy comment maxEmbedded

a guest
May 7th, 2013
113
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*Using Atmega48PA*/
  2. #include <avr/io.h>
  3.  
  4. int main(void)
  5. {
  6. PORTC = 0×00; //disabling Pull-Up
  7. DDRC = 0xFF;
  8.  
  9. DDRB = DDRB & 0b11111100;
  10. unsigned char driveBuffer=0;
  11. while(1)
  12. {
  13. if(PINB & 0b11111100)
  14. {
  15. driveBuffer = 0xFE;
  16. }
  17. else if(PINB & 0xFD)
  18. {
  19. driveBuffer = 0xFD;
  20. }
  21. else if(PINB & 0xFE)
  22. {
  23. driveBuffer= 0xFC;
  24. }
  25. else if(PINB == 0b11111111)
  26. {
  27. driveBuffer = 0xFB;
  28. }
  29.  
  30. PORTC = driveBuffer;
  31. }
  32.  
  33. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement