Advertisement
Guest User

Exercise 3

a guest
Mar 20th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #include "C8051F340.h"
  2.  
  3.  
  4. void main(void){
  5.  
  6.  
  7. P2MDOUT = 0x0C; // pullup for LEDs
  8. P0SKIP = 0xFF; // skip P0
  9. P1SKIP = 0xFF; // skip P1
  10. XBR1 = 0x70; //
  11. OSCICN = 0x83; // Internal H-F clock: SYSCLK=12MHz
  12. PCA0MD &= 0xBF; //watchdog configure
  13. PCA0MD = 0x00; //watchdog disable
  14.  
  15.  
  16. // TMOD = 0x10; //TIMER 0, 8bits with auto-reload
  17.  
  18. TF2 = 0; //clear flag
  19. TMR2L = 0x18;
  20. TMR2H = 0xFC;
  21. TMR2RLH = 0xFC;
  22. TMR2RLL = 0x18;
  23. T2SPLIT = 0;
  24. TR2 = 1;
  25.  
  26. while(1){
  27.  
  28. if(TF2){
  29.  
  30. TF2 = 0;
  31. P2_2 =! P2_2;
  32.  
  33. }
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement