I just started writing a C application for the Cygnal C8051F125 and am having difficulty setting/viewing the paged SFR's Here's a simple example in C code: SCON0=0x50; SCON1=0x40; Compiles fine, but when when I open the disassembly window, these 2 statements get translated to: MOV SCON0(0x98),#0x50 MOV SCON0(0x98),#0x40 i.e., both statements modify SCON0. This is confirmed by opening the peripheral window and examining Serial port 1 and 2 --- SCON1 never changes (?????) I understand the SFRs on the chip are spread over 5 pages, sharing common "base addresses" (0x98 in this case), but how do I access a specific page? And how do I view the different pages in the memory window? This CAN'T be a bug, so what am I doing wrong? Thanks, Joe
I thought my previous answer to this question answered all these questions: http://www.keil.com/forum/docs/thread3024.asp Anyway, the simulation description for the Cygnal C8051F125 (http://www.keil.com/dd/chip/3474.htm) includes the following note: NOTE Simulation for this device is provided by the default peripheral simulation driver. Complete on-chip peripheral simulation is not available at this time. For each simulation DLL we create, there exists a default driver that is intended to be a catchall for those devices that are not explicitly simulated. This works better in some cases than in others. Maybe you guys can help us come up with the best text to use that clearly states that the default simulation driver is used (and that it may not match the device 100%). As far as I can tell, Cygnal parts have the greatest deviation from the default driver. Jon
You can still access the sfr's from C, without using assembly. It'll just take you two statements.
SFRBASE = 1; SCON1 = 0x50;
#define PagedSfr(name,page) SFRBASE = page, name##page
val = PagedSfr(SCON, 1); PagedSfr(SCON, 1) = val; PagedSfr(SCON, 0) = val;