Advertisement
artones

Untitled

Mar 31st, 2021
336
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $NOMOD51
  2. $include (C8051F120.h)
  3. LED BIT P1.6;
  4. Flag BIT 00h
  5. CSEG AT 0;
  6. LJMP MAIN;
  7. ORG 000Bh;
  8. AJMP T0_ISR
  9. ; Peripheral specific initialization functions,
  10. ; Called from the Init_Device label
  11. Reset_Sources_Init:
  12. mov WDTCN, #0DEh               
  13. mov WDTCN, #0ADh
  14. ret
  15. Timer_Init:
  16. mov SFRPAGE, #TIMER01_PAGE 
  17. mov TMOD, #01h;            
  18. ret
  19. Port_IO_Init:
  20. mov SFRPAGE, #CONFIG_PAGE      
  21. mov P1MDOUT, #040h
  22. mov XBR2, #040h
  23. ret
  24. Interrupts_Init:
  25. mov IE, #082h;             
  26. ret
  27. Init_Device:
  28. lcall Reset_Sources_Init       
  29. lcall Port_IO_Init
  30. lcall Timer_Init
  31. lcall Interrupts_Init
  32. ret
  33. T0_ISR:
  34.     CLR TF0;
  35.     DJNZ R0, OUT;
  36.     MOV R0, #06h;
  37.     SETB Flag;
  38.     OUT: RETI;
  39. MAIN:
  40.     lcall Init_Device;
  41.     CPL LED;
  42.     MOV R0, #06h;
  43.     CLR FLAG;
  44.     SETB TR0;
  45. LOOP:
  46.     JBC Flag, SKIP;
  47.     SJMP LOOP;
  48. SKIP:
  49.     CPL LED;
  50.     SJMP LOOP;
  51.     END
Advertisement
RAW Paste Data Copied
Advertisement