hello, I'm trying to learn assembler and I'm using an Attiny 4313, using avr-as. I modified the .include file by replacing all the = with , and it compiles.
I wrote a simple hello world program that turns on a light and that worked, however looping doesn't seem to work:
.nolist .include "tn2313def.h" .list rjmp init init: ser r16 out DDRB, r16 ;DDRB = 0xff out DDRD, r16 ;DDRD = 0xff clr r16 ldi r17, 0xfe out PORTD, r17 rjmp rob rob: ;r17 will be my portd counting reg. ;ror r16 inc r16 out PORTB, r16 dec r17 out PORTD, r17 dec r17 out PORTD, r17 rjmp rob
I'm operating a matrix where the rows are + and hooked to PORTB and columbs are - and hooked to PORTD. so, this code in its first run of the loop, increments r16 to 1, so one row is active. I use r17 with PORTD and set it to 0xfe, so it grounds one column, once it enters the loop, i dec r17 again so its 1111 1101, then output to portd for some reason and dec again so that its 1111 1100, and that shows up as two lights on. But heres the thing, it doesnt jump back to rob + 1, otherwise, the rows would be changing, or all on bc of the inc r16 out PORTB, r16. I'm really new to all of this and it could be how I'm setting up the actual assembler file, perhaps it needs .global or the .cseg version for avr-as. it could even be my manipulated tn2313def.h being used on a 4313. however I'm pretty sure that its all code compatible. Any help would be much appreciated