The bug in SX48/52?
I find the strange work of the SX48 and SX52 MCU's.
This is a simple program for demonstration this bug:
The value of R0 in breakpoint must be 200. Ok?
But it is 201! Why?
When I move "Work" in other program memory address (nor offset + 0x800), all work fine.
When disabled RTCC interrupt, this works fine too.
This is a simple program for demonstration this bug:
DEVICE PINS52,OSCHS2 IRC_CAL IRC_SLOW FREQ 5000000 ; May be any offset = 0x004 ; May be other (0x004..0x700..) RESET start org 0x0a R0 ds 1 ; R1 ds 1 ; watch R0,8,udec org 0 jmp @serv start page main jmp main org offset+2 serv reti main Mov RTCC,#19 Mov !option,#10001000b ; RTCC start jmp @Work org offset+0x800 Work nop clr R0 Mov R1,#200 :loop nop nop inc R0 djnz R1,:loop nop break jmp $-1 end
The value of R0 in breakpoint must be 200. Ok?
But it is 201! Why?
When I move "Work" in other program memory address (nor offset + 0x800), all work fine.
When disabled RTCC interrupt, this works fine too.
Comments
You need to condense the code to the absolute minimum that still causes the problem.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
There are only two guaranteed ways to become weathy.
Spend less than you make.
Make more than you spend.
·
Not everything, but only if the main program and interrupt service routine are on defined distance in program memory space (this distance is near 0x800).
The main program (Work) has two counters - R0 and R1. The R1 is cycle counter, the start value is 200 (as example). R0 is independent counter, = 0 before cycle, and increment every loop.
The interrupt service routine (serv) is dummy, and caused by RTCC rollover every 256 MCU clocks.
The value of R1 after cycle must be equal R0 before it, i.e. 200, not so?
But in this program conditions it is 201!
If the Work routine is on other distance relativelly serv routine, all works ok.
One problem is that the SX52 is obsolete and I'm not sure if I have an SX52 protoboard. Does the problem occur on the SX48 ?
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
There are only two guaranteed ways to become weathy.
Spend less than you make.
Make more than you spend.
·
On SX48 (0547 prod.) this problem occur too.
It seems to be a debugger issue to me.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
There are only two guaranteed ways to become weathy.
Spend less than you make.
Make more than you spend.
·
This is one more version of bug demo program. It counts errors, and shows errcnt on RA.(0..3).