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

reentrant function

hi,

1'm using the RTX51Tiny and am trying to implement a "mailbox"-like function to allow tasks to intercommunicate. The core structure of my program looks like this:

//startup.a51 has been modified for
//small reentrant stack

//prototype
void WriteMailBox(unsigned char NewData) small reentrant;
unsigned char ReadMailBox(void);

//mailbox variable
unsigned char MailBox;

//accesor function to mailbox
void WriteMailbox(unsigned char NewData) reentrant
{
MailBox = NewData;
}

unsigned char ReadMailBox(void)
{
return(MailBox);
}

The problem arises when I try to call the WriteMailbox function in an interrupt service routine. The mailbox is not updated when the isr exits- this shows when another function calls ReadMailBox and the data dosn't match.

I'd appreciate any form of help/pointer/comment.

Thanks in advance!