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
You CAN set the registers in C code. You can set any registers, including the Page register, which is just another SFR. There is no need to use assembler, but also nothing wrong with using an assembler routine to push/pop the page before/after changing it.
I would also like to nominate this thread for "Best Descriptive Title"