0

I am starting to write a assembly program for a mc68hc12. I will be reading a 8 bit signed number into PortA and outputting the results to 7 segment LED's, common anode. I will be using Port P to ouput the segments and PortCan to control the LED's displayed. I assume I need 4 LED's, 1 for the sign and 3 LEDs for the max number of 128. If I hard wired the data in I get something like below. How would I go about pulling the data in from a port and then displaying the number on a set of LED's?

org $1000
        ldaa #$ff
        staa DDRP
        ldaa #$7c
        staa DDRCAN
forever ldy #display
next    ldaa 0,y
        staa PORTP
        ldaa PROTCAN
        anda #$83
        staa PROTCAN
        ldaa 1,y
        oraa PORTCAN
        staa PORTCAN

;a delay subroutine here to would cycle back to forever

display
       fcc  $30,$40
       fcc  $6d,$20
       fcc  $79,$10
       fcc  $33,$08
       fcc  $5b,$04

Thanks

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by chrisname
0

I am starting to write a assembly program for a mc68hc12. I will be reading a 8 bit signed number into PortA and outputting the results to 7 segment LED's, common anode. I will be using Port P to ouput the segments and PortCan to control the LED's displayed. I assume I need 4 LED's, 1 for the sign and 3 LEDs for the max number of 128. If I hard wired the data in I get something like below. How would I go about pulling the data in from a port and then displaying the number on a set of LED's?

org $1000
        ldaa #$ff
        staa DDRP
        ldaa #$7c
        staa DDRCAN
forever ldy #display
next    ldaa 0,y
        staa PORTP
        ldaa PROTCAN
        anda #$83
        staa PROTCAN
        ldaa 1,y
        oraa PORTCAN
        staa PORTCAN

;a delay subroutine here to would cycle back to forever

display
       fcc  $30,$40
       fcc  $6d,$20
       fcc  $79,$10
       fcc  $33,$08
       fcc  $5b,$04

Thanks

If you know what the port is (e.g. 0x60 is the keyboard on a computer) you can use in.

It's used like this (AT&T syntax):

inb 0x60, %eax

which would store the data from the keyboard in eax. You'll probably want to store it elsewhere, though.

Hope this helps.

Edited by chrisname: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.