Advertisement
hibbzboi

Trzy diodki

Mar 22nd, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. TRZY DIODKI
  2.  
  3. #include <p24fj128ga010.h>
  4.  
  5. _CONFIG1(JTAGEN_OFF & GCP_OFF & GWRP_OFF & BKBUG_OFF & COE_OFF & FWDTEN_OFF)
  6. _CONFIG2(FCKSM_CSDCMD & OSCIOFNC_ON & POSCMOD_HS & FNOSC_PRI)
  7.  
  8. #define SCALE 308L
  9.  
  10. int main(void)
  11. {
  12. unsigned long i;
  13. unsigned char display=1;
  14. PORTA=0x0000;
  15. TRISA=0xFF00;
  16. TRISD=0xFFFF;
  17. display = 7;
  18.  
  19. wLewo:
  20. Nop();
  21. PORTA=(unsigned int) display;
  22. for(i=500L*SCALE;i>0;i--) Nop();
  23. if(display == 224)
  24. goto wPrawo;
  25. else
  26. display = display * 2;
  27. goto wLewo;
  28.  
  29.  
  30. wPrawo:
  31. Nop();
  32. PORTA=(unsigned int) display;
  33. for(i=500L*SCALE;i>0;i--) Nop();
  34. if(display == 7)
  35. {
  36. display = display * 2;
  37. goto wLewo;
  38. }
  39. else
  40. display=display / 2;
  41. goto wPrawo;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement