??? 05/12/08 15:52 Read: times |
#154711 - Struct member losing value |
I've got a peculiar situation here that I'm figting with that I hope someone can help me with. I'm using the Silicon Labs IDE, SDCC, and the Silicon Labs 8051F340. When I refer to "checking values" below I am using printf to send the data out over the serial port to another PC listening with Hyperterm.
I've got a structure defined like this: (main.h) struct ContactType {char id; int bearing;}; extern xdata struct ContactType Contact[10]; (main.c) xdata struct ContactType Contact[10]; I go on to populate Contact inside my external interrupt handler (the data comes in over the UART and is signalled ready via the external interrupt). The code is similar to this: ... Contact[0].id = '5'; Contact[0].bearing = 360; ... draw(CONTACT_SCREEN); // send the data to the LCD I have checked the data right before the call to draw() and it is as expected, 5, 360. Then I check right away inside draw() and my data is 5, 360. Then a bit later inside draw() when I get around to using the data, it is 5, 256. Any ideas on how and why this value is changing? |
Topic | Author | Date |
Struct member losing value | 01/01/70 00:00 | |
Please post your code | 01/01/70 00:00 | |
Posted here (along with file descriptions): | 01/01/70 00:00 | |
the can of worms | 01/01/70 00:00 | |
Your program needs to be restructured | 01/01/70 00:00 | |
Can't mod this one up enough. | 01/01/70 00:00 | |
Thanks for the tips | 01/01/70 00:00 | |
You're doing pretty good then. | 01/01/70 00:00 | |
I think that it can be said in a simple way | 01/01/70 00:00 | |
Sorry but.. | 01/01/70 00:00 | |
Agreed | 01/01/70 00:00 | |
the phrase was | 01/01/70 00:00 | |
I agree | 01/01/70 00:00 | |
Don't ignore rules | 01/01/70 00:00 | |
What is "short" in an ISR...? | 01/01/70 00:00 | |
Two Program | 01/01/70 00:00 | |
breaking switch/case![]() | 01/01/70 00:00 | |
Do you understand why? | 01/01/70 00:00 | |
make it a FAQ, please... | 01/01/70 00:00 |