8 bit led counter on assembly. How do I increment the counter value, x within this loop?

302 Views Asked by At

I need some help with an 8 bit counter in Assembly. I want to map this to I/O portB to be used by the Led. To explain it further what happens is that the counter decrements each time before and loops back until it reaches zero. At the same a value x is incremented until it reaches 255. The value x is then pushed to the led pins in port B. will INX increment the desired count value like I am expecting it to, From 0 to 255? AN insert of the main portion of the code is below.

mycount EQU $1000;             count

MOVB #$FF,DDRB;   configure port B output 

Main:
 Again:MOVB #$FF,mycount;  set count lop
       LDX #0;             load count val
       STX PTB;           store count led
       INX;                Increment X
       DEC  mycount;      Decrement count
       BNE Again;      Loop if count =/=0
0

There are 0 best solutions below