We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, All the SP, STKOV, and STKUV's highest 4 bits are masked to '1'. Does that mean those registers have to be 0xFxxx only? May I change the system stack to somewhere else, say 0xc200? Thanks a lot.
All the SP, STKOV, and STKUV's highest 4 bits are masked to '1'. Does that mean those registers have to be 0xFxxx only? Yes. May I change the system stack to somewhere else, say 0xc200? No, you can't do that. It's a hardware limitation. Even if you try to write something other than 0xFxxx to SP, STKOV, or STKUN, the 4 most significant bits will be ignored. - mike
Thanks a lot, Mike.
But if SP is limited to 0xFxxx, which means up to 4K bytes, why does the manual say "the XC161 supports a system stack up to 64KBytes"? - at chapter 4.7.5
I'm not sure which manual you are referring to. From your original question I got the idea that you meant the C16x family of microcontrollers. Those indeed support system stack only in 0xF000-0xFFFF area. But from this question why does the manual say "the XC161 supports a system stack up to 64KBytes"? - at chapter 4.7.5 I get the impression that you are intrested in the XC161 microcontroller. The two families C16x and XC16x are different. They use different CPU cores, and XC16x's CPU is an improved version of C16x's CPU. The newer version is faster and more flexible, while maintaining a great degree of compatibility with the previous version. Among other things, XC16x's CPU core does support 64K bytes of system stack. - mike
I am using XC161CJ. The manual says that it supports up to 64KB system stack. But it also describes SP, STKOV, and STKUN registers are masked to 0xFxxx. That is why I am confused.
I downloaded the XC161 User Manual V2.1 from Infineon's web site. It does show the SP, STKOV, and STKUN as having their 4 most significant bits tied to '1'. It doesn't make any sense unless it's a typo. I have version 1.1 of that document, and it doesn't have this typo. I can only assume that the author of the XC161 manual used portions of the C16x family manual when compiling the document and missed that particular point. Reporting this typo to mcdocu.comments@infineon.com would be a good idea. - mike
I just reported this to Infineon. The interesting thing is, Keil's simulator ties the 4 significant bits of SP/STKUN/STKOV to 1.
The interesting thing is, Keil's simulator ties the 4 significant bits of SP/STKUN/STKOV to 1. That's what they get for reading the manual!