HI!, I have a big problem when i define global variables, because the execution programs is doing extranges things.
I have 2 task. READ and WRITE
void Read (void) _task_ READ _priority_ 0 { unsigned int ReceivedMessage; while(1){ ReceivedMessage=_getkey(); os_send_message (MAILBOX, ReceivedMessage, WAIT_FOREVER); } } void Write (void) _task_ WRITE _priority_ 1 { unsigned int Message[6]; while(1){ P2=0x01; for(i=0;i<6;i++){ os_wait (K_MBX + MAILBOX, WAIT_FOREVER, &Message[i]); P2<<=1; } /* ACCIONS */
but i need 3 variables for to save the results of the ACCIONS for share with others task. At the top i declared the variables:
int ax,bx,cx
it is ok?? Maybe can do it others way??
Thanks
javi, it is a pity that you did not post all the relevant pieces of code related to ax, bx, cx. however, it sounds like a race condition: your tasks are accessing these variables without coordination/synchronization. you would have to lock the access to any data (including ax, bx, cx) that is shared by more than one task. check out your RTOS documentation for the relevant routines,