WHATS happening here?
duffling
Posts: 73
why does the LED turn off in debug mode .. yet not when i program the sx?
what am I doing wrong?
;
DEVICE DIRECTIVES
··DEVICE··SX28,OSC4MHZ,TURBO,STACKX,OPTIONX
········ IRC_CAL··IRC_SLOW
··FREQ ·50_000_000
··RESET··Initialize
;
VARIABLES
COUNT1 EQU $09
COUNT2 EQU $10
WATCH COUNT1,8,UDEC
;
INITIALIZATION ROUTINE
Initialize
··;Configure port settings
mov !rb,#%01111111··· ;SET RB.7 AS OUTPUT FOR LED
;
MAIN PROGRAM
MAIN
CLR COUNT1
CLR COUNT2
MOV RB,#%00000000
LOOP·················· ; SHORT DELAY
DJNZ COUNT1,LOOP
DJNZ COUNT2,LOOP
··· ; TURN OFF LED
MOV RB,#%10000000···
END
·
what am I doing wrong?
;
DEVICE DIRECTIVES
··DEVICE··SX28,OSC4MHZ,TURBO,STACKX,OPTIONX
········ IRC_CAL··IRC_SLOW
··FREQ ·50_000_000
··RESET··Initialize
;
VARIABLES
COUNT1 EQU $09
COUNT2 EQU $10
WATCH COUNT1,8,UDEC
;
INITIALIZATION ROUTINE
Initialize
··;Configure port settings
mov !rb,#%01111111··· ;SET RB.7 AS OUTPUT FOR LED
;
MAIN PROGRAM
MAIN
CLR COUNT1
CLR COUNT2
MOV RB,#%00000000
LOOP·················· ; SHORT DELAY
DJNZ COUNT1,LOOP
DJNZ COUNT2,LOOP
··· ; TURN OFF LED
MOV RB,#%10000000···
END
·
Comments
When the SX executes the code, generated from your sample program, it will run into "nowhere land" after doing the MOV RB, #%10000000. This unprogrammed area of the program memory usually contains $FFF in each location.
Just add
jmp $
following the
MOV RB, #%10000000
to bring the SX into an endless loop.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
G
is a jump to the current program address, and that instruction is cryptic to some.
The equivalent less cryptic command is:
And just at Guenther mentioned the program is in an endless loop to nowhere.
K