This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

XC866 - Paging causes to unexpected jump

Hi all,

I am a newbie in 8-bit programming related to
8051 based devices.

Can somebody of the professionals help me in the following case ?

/* These is extracted from MAIN.H file,
   which DAvE has generated
*/
//   CCU6_PAGE
#define _cc0 CCU6_PAGE=0 // CCU6_PAGE postfix
#define _cc1 CCU6_PAGE=1 // CCU6_PAGE postfix
#define _cc2 CCU6_PAGE=2 // CCU6_PAGE postfix
#define _cc3 CCU6_PAGE=3 // CCU6_PAGE postfix
// Save/Restore
#define SST0  0x80        // Save SFR page to ST0
#define RST0  0xC0        // Restore SFR page from ST0
#define SST1  0x90        // Save SFR page to ST1
#define RST1  0xD0        // Restore SFR page from ST1
#define SST2  0xA0        // Save SFR page to ST2
#define RST2  0xE0        // Restore SFR page from ST2
#define SST3  0xB0        // Save SFR page to ST3
#define RST3  0xF0        // Restore SFR page from ST3
#define noSST 0x00        // Switch page without saving
// Switch a page
#define SFR_PAGE(pg,op) pg+op

//--- in main() ---
...
	MAIN_vInit();

  	SFR_PAGE(_cc2,SST3);
	   CCU6_ISSL |= 0x80;
	SFR_PAGE(_cc0,RST3);
...
//---

MAIN_vInit() does a setup for CCU6
(aka CAPCOM6) which enables an interrupt
for period match.
CCU6_ISSL |= 0x80 triggers this interrupt by software.
( Or should do this. )

The page switching is right done as I checked, but have a look at disassembly window I got

C:0x171F    D1CB     ACALL    MAIN_vInit(C:16CB)
   460:   SFR_PAGE(_cc2,SST3);
C:0x1721    75A3B2   MOV      CCU6_PAGE(0xA3),#PORT_PAGE(0xB2)
   461:            CCU6_ISSL |= 0x80;
C:0x1724    43A480   ORL      CCU6_T12DTCL(0xA4),#P0_DATA(0x80)
   462:         SFR_PAGE(_cc0,RST3);
   463:
C:0x1727    75A3F0   MOV      CCU6_PAGE(0xA3),#B(0xF0)
and single stepping the ORL instruction I recognized, I will arrive at

C:0x006C 00 NOP
C:0x006D 026000 LJMP C:6000
C:0x0070 00 NOP
C:0x0071 00 NOP

what seems to me that I am, however, jumping
to startup code.
So I can not check at this moment, whether the ISSL is OR-ed right.

Has anybody an idea, what goes wrong here ?
Any idea, help, enlighting is welcome,
since I spend a whole day with different debug sessions and have no idea anymore.
( Hope it is not so difficult for the experts in this forum )

Using: C51 latest (beta) release and DAvE

Thanks Stefan

Parents Reply Children
No data