prjbrook

Tiny15 sends new serial protocol slow to Arduino

Aug 6th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. ;three counters r17,r18,r19 loop 256*256*9 * 484uS = about 1 second at 1.6MHz
  2. ;used: avrasm2 -fI -l list.lst TinyFlashA.asm
  3. ;and for another file used: avrdude -p ATtiny15 -c usbasp -U flash:w:blinker15_B.hex:i
  4. ;output via LED 8 bit sequence eg r0 = $0F. Looked good on LED. Running human slow so I can see what's happening.
  5. ;1/8/19. Put Macros intoseparate txt file that gets included.
  6. .include "tn15def.inc"
  7. .include "t15MACROS_A.txt"
  8.  
  9. .ESEG eevar1: .DW 0x0123 ; initialize 1 word in EEPROM Doesn't burn into eeprom
  10. ;Had to use C:\Users\Dell\Desktop\Setup Files\AVR_assembler_avrasm2>avrdude -p ATtiny15 -c usbasp -U flash:w:MacroExperimentC.hex:i -U eeprom:w:eeprom5.raw:r
  11. .CSEG
  12.  
  13. .LISTMAC
  14. start:
  15. ldi r16,$ff
  16. out DDRB,r16
  17.  
  18. ldi r16,2
  19. mov eepromLimit, r16 ;counter fro number of eeprom bytes to output
  20. exp1: ;start long tone here
  21. ldi r16,$fe ;random. Just for testing
  22. mov r0,r16 ;so we can bit-bang r0 with below.
  23. clr r1 ;start at eemrom adr 0
  24.  
  25. doSerial: ;serially output bits that are in r0
  26.  
  27. getEepromByte r1,r0
  28. ldi r16,$08 ;for 8 bits
  29. mov r2,r16 ;so r2 is our bit counter
  30. pinUp
  31. longIntro
  32. doBit: ;cycle from here 8 times to get all bits out of r0 thru carry.
  33. pinDown
  34. wait3
  35. pinUp
  36. delay1
  37. rol r0 ;send LH bit into carry
  38. brcs down ;is it a one
  39. pinDown ;if here, must have been a zero in carry. So drop pin to lowy
  40. down:
  41. delay1 ;with pin up or down. Key step in this prog
  42. pinUp ;maybe already up. Check for jitter.
  43. delay1 ;finish off frame
  44. delay1 ;just a stop bit. Necessary?
  45. dec r2 ;counter reached zero yet (from 8)
  46. breq nextByte ;if we've reached 0, all 8 bits are gone. Get out.
  47.  
  48. rjmp doBit ;couldn't use branches, eg brne doBit as it's too far.
  49. nextByte:
  50. inc r1 ;bump eeprom adr
  51. cp r1,eepromLimit ;got to limit of eeprom bytes required?
  52. breq endL ;if yes get out
  53. rjmp doSerial
  54.  
  55. // rjmp exp1 ;**take out later
  56. //getEepromByte r1,r0
  57.  
  58. endL: rjmp endL
Add Comment
Please, Sign In to add comment