Hello, I am currently taking a summer class for microcontroller 1 and i am having issues doing one of the labs.
The chip we are using is HC(S)12 with CodeWarrior.
Basically our task is write a program to repetitively count from 0 to $FF.
Advance the count every 0.5 second . Display the bytes in the Hex on seven segment display printed circuit board(PCB). using PORTE connections on HCS12.
I got the board to display from 0 to $F (Least sig byte) but part i am having trouble is with displaying MSB after LSB finishes counting upto $F.
Here is what i have so far:
; include derivative specific macros
; INCLUDE 'mc9s12dg128.inc'
;
; include files
include 'constants.inc'
; (a file containing EQUATES of I/O port addresses, bit masks, etc)
;EQUATES
RAM EQU $0800
STACK EQU $0A00
ABSENTRY Start
ORG RAM
Start lds #STACK
ldaa #ALLBIT ;1111 1111 configure all LEDs as outputs
staa DDRA
ldaa #ALLBIT
staa DDRE
Here
ldx #Table ;
ldy #16
ldab #0
Count
ldaa b,x ;b+x =a
staa PORTA
jsr FlashLS
jsr Delay1
stab PORTE
inx ;increment one address in table by 1
dey
bne Count
;Subroutines
Delay1 pshx
psha
ldaa #50 ;delay 0.5 Seconds
Loop ldx #10000
Delay dex
bne Delay
deca
bne Loop
pula
pulx
rts
FlashLS
pshx
psha
bset PORTE,%00000100
clr PORTE
pula
pulx
rts
FlashMS
pshx
psha
bset PORTE,%00001000
clr PORTE
pula
pulx
rts
Table DC.B $FC,$60,$DA,$F2,$66,$B6,$BE,$E0,$FE,$E6,$EE,$3E,$9C,$7A,$9E,$8E
END
;*********************************************************
;* Interrupt Vectors *
;*********************************************************
ORG $FFFE
DC.W Entry ; Reset Vector
Any help will be appreciated
Thanks
The chip we are using is HC(S)12 with CodeWarrior.
Basically our task is write a program to repetitively count from 0 to $FF.
Advance the count every 0.5 second . Display the bytes in the Hex on seven segment display printed circuit board(PCB). using PORTE connections on HCS12.
I got the board to display from 0 to $F (Least sig byte) but part i am having trouble is with displaying MSB after LSB finishes counting upto $F.
Here is what i have so far:
; include derivative specific macros
; INCLUDE 'mc9s12dg128.inc'
;
; include files
include 'constants.inc'
; (a file containing EQUATES of I/O port addresses, bit masks, etc)
;EQUATES
RAM EQU $0800
STACK EQU $0A00
ABSENTRY Start
ORG RAM
Start lds #STACK
ldaa #ALLBIT ;1111 1111 configure all LEDs as outputs
staa DDRA
ldaa #ALLBIT
staa DDRE
Here
ldx #Table ;
ldy #16
ldab #0
Count
ldaa b,x ;b+x =a
staa PORTA
jsr FlashLS
jsr Delay1
stab PORTE
inx ;increment one address in table by 1
dey
bne Count
;Subroutines
Delay1 pshx
psha
ldaa #50 ;delay 0.5 Seconds
Loop ldx #10000
Delay dex
bne Delay
deca
bne Loop
pula
pulx
rts
FlashLS
pshx
psha
bset PORTE,%00000100
clr PORTE
pula
pulx
rts
FlashMS
pshx
psha
bset PORTE,%00001000
clr PORTE
pula
pulx
rts
Table DC.B $FC,$60,$DA,$F2,$66,$B6,$BE,$E0,$FE,$E6,$EE,$3E,$9C,$7A,$9E,$8E
END
;*********************************************************
;* Interrupt Vectors *
;*********************************************************
ORG $FFFE
DC.W Entry ; Reset Vector
Any help will be appreciated
Thanks