;**************************************************************
;* This stationery serves as the framework for a *
;* user application. For a more comprehensive program that *
;* demonstrates the more advanced functionality of this *
;* processor, please see the demonstration applications *
;* located in the examples subdirectory of the *
;* Freescale CodeWarrior for the HC12 Program directory *
;**************************************************************
; Include derivative-specific definitions
INCLUDE 'derivative.inc'
; export symbols
XDEF Entry, _Startup, main
; we use export 'Entry' as symbol. This allows us to
; reference 'Entry' either in the linker .prm file
; or from C/C++ later on
XREF __SEG_END_SSTACK ; symbol defined by the linker for the end of the stack
; variable/data section
MY_EXTENDED_RAM: SECTION
; Insert here your data definition.
ORG $1100
value ds.b 1
ORG $1105
; code section
MyCode: SECTION
main:
_Startup:
Entry:
LDS #__SEG_END_SSTACK ; initialize the stack pointer
CLI ; enable interrupts
;***************************************************************************
;* Program to turn ONN *
;* ALL *
;* Turn OFF All the four LEDS *
;***************************************************************************
movb #$0F,DDRT
ldaa #$00
in:
staa value
movb value,PTT
;wait for 0.75 sec
jsr delay_By_0.75sec
;increment the value of counter
inca
cmpa #$0F
bls in
L1: bra L1
;********************************************************************
;* Sub routine to generate delay of 0.75 sec
;*
;********************************************************************
delay_By_0.75sec:
; running 10 time the inner loop we will get 10*75ms =0.75sec delay
ldab #10
out_loop:
;inner loop will generate delay of 75 ms we will have to repeat this process 45000 times to genrate this delay of 75ms
ldx #45000
in_loop:
psha
pula
psha
pula
psha
pula
psha
pula
psha
pula
psha
pula
psha
pula
psha
pula
nop
nop
dbne x,in_loop
dbne b,out_loop
rts
I am having troulbe getting this code to work on my tower module. I am using the freescale TWR-S12G128 with codewarrior. I have compiled the above program and debugged it with no trouble. the problem is the LED's are not lighting up at all and I don't know why. I am pretty sure the code I have written is correct. Any help would be appreciated. thank you.