Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;three counters r17,r18,r19 loop 256*256*9 * 484uS = about 1 second at 1.6MHz
- ;used: avrasm2 -fI -l list.lst TinyFlashA.asm
- ;and for another file used: avrdude -p ATtiny15 -c usbasp -U flash:w:blinker15_B.hex:i
- ;output via LED 8 bit sequence eg r0 = $0F. Looked good on LED. Running human slow so I can see what's happening.
- ;1/8/19. Put Macros intoseparate txt file that gets included.
- .include "tn15def.inc"
- .include "t15MACROS_A.txt"
- .ESEG eevar1: .DW 0x0123 ; initialize 1 word in EEPROM Doesn't burn into eeprom
- ;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
- .CSEG
- .LISTMAC
- start:
- ldi r16,$ff
- out DDRB,r16
- ldi r16,2
- mov eepromLimit, r16 ;counter fro number of eeprom bytes to output
- exp1: ;start long tone here
- ldi r16,$fe ;random. Just for testing
- mov r0,r16 ;so we can bit-bang r0 with below.
- clr r1 ;start at eemrom adr 0
- doSerial: ;serially output bits that are in r0
- getEepromByte r1,r0
- ldi r16,$08 ;for 8 bits
- mov r2,r16 ;so r2 is our bit counter
- pinUp
- longIntro
- doBit: ;cycle from here 8 times to get all bits out of r0 thru carry.
- pinDown
- wait3
- pinUp
- delay1
- rol r0 ;send LH bit into carry
- brcs down ;is it a one
- pinDown ;if here, must have been a zero in carry. So drop pin to lowy
- down:
- delay1 ;with pin up or down. Key step in this prog
- pinUp ;maybe already up. Check for jitter.
- delay1 ;finish off frame
- delay1 ;just a stop bit. Necessary?
- dec r2 ;counter reached zero yet (from 8)
- breq nextByte ;if we've reached 0, all 8 bits are gone. Get out.
- rjmp doBit ;couldn't use branches, eg brne doBit as it's too far.
- nextByte:
- inc r1 ;bump eeprom adr
- cp r1,eepromLimit ;got to limit of eeprom bytes required?
- breq endL ;if yes get out
- rjmp doSerial
- // rjmp exp1 ;**take out later
- //getEepromByte r1,r0
- endL: rjmp endL
Add Comment
Please, Sign In to add comment