The program needs to display in a 7 segment display the numbers from 0 to 9, and then repeat the count (from 9 display again the number 0 and so on).
There is no need to put input buttons.
I must use lookup tables for this program.
I´m programming in assembler in Microchip Studio, using the atmega328p and simulating in proteus. Here's my schematic.
The program runs very well from 0 to 9 but after 9 the segments instead of displaying 0 (0x3F) the "f" and "d" segments are on (0x28), then the "f" and "g" segments are on (0X60).
Just not going back to 0 and starting again the sequence.
.org $00 .cseg ldi r16,$ff out ddrb,r16 start: ldi ZL, low(table*2) ldi ZH, high(table*2) ldi r16,$A clr r17 count: lpm r17,Z+ dec r16 out portb,r17 call delay cpi r16,0 breq start jmp count table: .db 0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F ; 0 1 2 3 4 5 6 7 8 9 delay: ldi r18,$8 delay2: ldi r19,$7d delay1: ldi r20,$fa delay0: dec r20 brne delay0 dec r19 brne delay1 dec r18 brne delay2 jmp count
I would really appreciate any help.