AnsweredAssumed Answered

How can I control a 7-segment display with a MC9S08SE8? (newbee)

Question asked by Ana Olay on Apr 2, 2013
Latest reply on Apr 8, 2013 by Monica Arvizu

Hello, everyone!

 

I have a task that is to do a 00 to 99 counter, the one I'll have to show in two 7-segment displays, but I'm having big troubles with the 7SD, because I have no idea of how can I control the displays, I've done the counter in the port B, here's the code:

 

; variable/data section

;

            ORG    RAMStart         ; Insert your data definition here

ExampleVar: DS.B   1

VAR1:       EQU    $0081

VAR2:       EQU    $0082

;

; code section

;

            ORG    ROMStart

; Include device initialization code

            INCLUDE 'MCUInit.inc'

 

 

_Startup:

            LDHX   #RAMEnd+1        ; initialize the stack pointer

            TXS

            ; Call generated Device Initialization function

            JSR    MCU_init

 

 

mainLoop:

LIMPIA:     MOV    #$FF, PTBDD  ;LIMPIA PUERTO B

            CLR    ($83)

           

CONTADOR:   INC    PTBD         ;INCREMENTO DEL CONTADOR

            BSR    DELAY

            LDA    PTBD         ;CARGA A ACUMULADOR CON CONTADOR

            BRA    COMPARADOR    ;SE VA AL CONVERSOR (PUEDE SER QUE SE QUITE 'BRA')

                   

           

DELAY:      MOV    #$01, VAR1

LOOP2:      MOV    #$01, VAR2

LOOP1:      DBNZ   VAR2, LOOP1

            DBNZ   VAR1, LOOP2

            RTS

                       

COMPARADOR:             

            INC    ($83)

            CMP    #$63

            BNE    CONTADOR

            BRA    LIMPIA

 

            NOP

 

The counter is shown as a binary counter in port B, what can I to make the displays work?

 

Outcomes