| ??? 07/12/03 08:40 Read: times |
#50530 - PSW.5 (General Purpose Flag F0) |
PSW Bit 5 (Flag Bit F0) == "General Purpose User Flag" Me the USER V.S. Keil C-51 sprintf Routine I tried to use the general purpose F0 flag which is located at the bit 5 position of the standard architecture 8051 PSW byte which is an SFR at address 0xD0. Can anyone out here in this community help me understand why in the world that a library call to the Keil C51 library function sprintf would be using this flag? I find it almost detestable that this is done by a library routine without mention of it it the Keil C compiler manual. (At least a 100% comprehensive search on "F0", "PSW.5" and "PSW ^ 5" did not turn up any mention that the library uses this flag!!! Finding this problem now leads to my having to discover another way to keep track of a global bit of information I need to have be valid between a boot loader function and my normal C51 application code. I have a relocated interrupt vector table in the C application code and then a physical to logical interrupt jump table that is located at the base of the code space. This area also contains a boot loader function I am placing there and this loader requires the use of several interrupts that are shared in use between the boot loader and the C application code. The interrupts are shared in a mutually exclusive manner such that the loader runs or the application runs. These shared interrupts vector off to a piece of interrupt flow A/B switch code that decides if the ISR in the boot routine should be activated or if the interrupt should be passed off to the coresponding logical interrupt vector in the C51 application code. I tried to use the PSW.5 bit to control this interrupt steering code. It works up until the first time the application code calls a sprintf() function to format a string for the LCD display. This results in changing the state if this bit and blowing my interrupt switch control sky high!!! The amazing thing is that the idea to use the user bit in the PSW came from a Knowledge Base article that I downloaded off the Keil WEB site !! Some 8051's have a second user flag bit at PSW.1 called F1. Does anybody know if I would have similar problems using this flag?? The part I am working with does have the F1 bit but I have not yet started to look at the feasiblity of its use. I'm still shell shocked from all the effort it took to find that the Keil sprintf() was mucking with the F0 flag. Michael Karas |
| Topic | Author | Date |
| PSW.5 (General Purpose Flag F0) | 01/01/70 00:00 | |
| RE: PSW.5 (General Purpose Flag F0) | 01/01/70 00:00 | |
| RE: PSW.5 (General Purpose Flag F1) | 01/01/70 00:00 | |
| RE: PSW.5 (General Purpose Flag F1) | 01/01/70 00:00 | |
| RE: PSW.5 (General Purpose Flag F1) | 01/01/70 00:00 | |
RE: PSW.5 (General Purpose Flag F1) | 01/01/70 00:00 | |
| RE: PSW.5 (General Purpose Flag F1) | 01/01/70 00:00 | |
| RE: PSW.5 (General Purpose Flag F1) | 01/01/70 00:00 | |
| RE: PSW.5 (General Purpose Flag F1) | 01/01/70 00:00 | |
| RE: PSW.5 (General Purpose Flag F1) | 01/01/70 00:00 | |
| RE: PSW.5 (General Purpose Flag F1) | 01/01/70 00:00 | |
| RE: PSW.5 (General Purpose Flag F1) | 01/01/70 00:00 | |
| RE: PSW.5 (General Purpose Flag F1) | 01/01/70 00:00 | |
| RE: PSW.5 (General Purpose Flag F1) | 01/01/70 00:00 | |
| RE: PSW.5 (General Purpose Flag F0) | 01/01/70 00:00 | |
| RE: PSW.5 (General Purpose Flag F0) | 01/01/70 00:00 |



