Hello every one I need some urgent help in programming an application, as I am new to assembly language as we as first timer using free scale MC9S08QG8 microcontroller.
I have 7 LED, I want to turn on each LED for 20 second and so on. So first LED will flashes for 20 sec then turn off, then second LED will flashes for 20 sec and off and so on. So far I have done this code, but the problem is that all of the LED are on and only one of them flashes all the time! Can anyone please fix my code!!!
Thanks in advance.
this is the code :
; ### clr $0060 clr $0061 ; ### CLI ; Enable interrupts RTS;** ===================================================================;** Interrupt handler : isrVtpmovf;**;** Description :;** User interrupt service routine. ;** Parameters : None;** Returns : Nothing;** =================================================================== XDEF isrVtpmovfisrVtpmovf: psha ; Write your interrupt code here ... inc $0060 lda $0060 ; every 20 s cmp #$02 bne isrNext clr $0060 inc $0061isrNext: lda $0061 cmp #$00 beq LED1 cmp #$01 beq LED2 cmp #$02 beq LED3 cmp #$03 beq LED4 cmp #$04 beq LED5 cmp #$05 beq LED6 cmp #$06 beq LED7 clr $0061LED1: brclr 0, PTAD, LED1b bclr 0, PTAD bra isrEndLED1b: bset 0, PTAD bra isrEndLED2: brclr 1, PTAD, LED2b bclr 1, PTAD bra isrEndLED2b: bset 1, PTAD bra isrEndLED3: brclr 2, PTAD, LED3b bclr 2, PTAD bra isrEndLED3b: bset 2, PTAD bra isrEndLED4: brclr 3, PTAD, LED4b bclr 3, PTAD bra isrEndLED4b: bset 3, PTAD bra isrEndLED5: brclr 6, PTBD, LED5b bclr 6, PTBD bra isrEndLED5b: bset 6, PTBD bra isrEndLED6: brclr 7, PTBD, LED6b bclr 7, PTBD bra isrEndLED6b: bset 7, PTBD bra isrEndLED7: brclr 1, PTBD, LED7b bclr 1, PTBD bra isrEndLED7b: bset 1, PTBDisrEnd: ;bclr 7, TPMSC pula rti; end of isrVtpmovf