Advertisement
Guest User

interfete

a guest
Nov 13th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. void setup() {
  2. DDRD=0x90;
  3. DDRB=0x01;
  4. }
  5.  
  6. unsigned char functie(unsigned char octet, unsigned char digit)
  7. {
  8. unsigned char temp, i;
  9. PORTB = 0x00;
  10. PORTD = 0x00;
  11.  
  12. for (i =0; i < 8; i++)
  13. {
  14. PORTD = 0x00; //pas 1
  15. temp = (octet >> (7 - i));
  16. temp = temp & 0x01;
  17. PORTB = temp; //pas 2
  18. PORTD = 0x80; //pas 3
  19. PORTB=0;
  20. }
  21. for (i =0; i < 8; i++)
  22. {
  23. PORTD = 0x00; //pas 1
  24. temp = (digit >> (7 - i));
  25. temp = temp & 0x01;
  26. PORTB = temp; //pas 2
  27. PORTD = 0x80; //pas 3
  28. PORTB = 0;
  29. }
  30. PORTB=0x00;
  31. PORTD=0x10;
  32.  
  33. }
  34.  
  35. int main(){
  36. unsigned char octet, temp, i;
  37. unsigned char digit;
  38. setup();
  39.  
  40. while(1){
  41.  
  42. functie(~0x5B,0x01);
  43.  
  44. functie(~0x5B,0x08);
  45.  
  46. functie(~0xbf,0x02);
  47.  
  48. functie(~0x06,0x04);
  49.  
  50.  
  51.  
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement