prjbrook

macros for previous post. Tiny 15

Aug 6th, 2019
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. .MACRO mac1
  2. ldi r22,$99
  3. .ENDMACRO
  4. .MACRO mac2
  5. mac1
  6. ldi r22,$92
  7. mac1
  8. .ENDMACRO
  9. .EQU delay17 = 0
  10. .EQU delay18 = 0
  11. .EQU delay19 = 3 ;delay constants that can change serial rate etc. 0,0,9 gives about 1second at 1.6MHz
  12. ;-----------
  13. .MACRO delay ;basic 1 period delay. Start slow then speed up
  14. ldi r17,@0
  15. ldi r18,@1
  16. ldi r19,@2
  17. up:
  18. dec r17
  19. brne up
  20. dec r18
  21. brne up
  22. dec r19
  23. brne up
  24. .ENDMACRO
  25. ;-----------
  26. .MACRO delay1 ;shortest delay used. Others are multiples of this.
  27. delay delay17,delay18,delay19
  28. .ENDMACRO
  29. ;----------------
  30. .MACRO pinUp ;make output pin go high
  31. sbi PORTB,4 ;outPin PB4, currently, goes high
  32. sbi PORTB,3 ;make Led pin follow so I can see it
  33. .ENDMACRO
  34. ;------------------
  35. .MACRO pinDown ;make output pin go low
  36. cbi PORTB,4 ;outPin PB4, currently, goes low
  37. cbi PORTB,3 ;make Led pin follow so I can see it
  38. .ENDMACRO
  39. ;------------------
  40. .MACRO longIntro ;the long tone before byte, about 4 seconds
  41. delay 0,0,$20
  42. .ENDMACRO
  43. ;----------------
  44. .MACRO wait3 ;the long wait at the first start bit. 3 * unit wait = "delay1"
  45. delay1
  46. delay1
  47. delay1
  48. .ENDMACRO
  49. ;---------------
  50. .MACRO getEepromByte ;use like getEepromByte r1,r0 to put into r0 eeprom byte adr in r1
  51. out EEAR,@0 ; usually r1 contains the adr
  52. sbi EECR,EERE ;or sbi $1c,0. The read strobe.
  53. in @1,EEDR ;eeprom byte now in EEDR. Send usually to r0
  54. .ENDMACRO
  55.  
  56. ;----------defs------------
  57. .DEF eepromLimit = r4
Advertisement
Add Comment
Please, Sign In to add comment