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

Problems with GLOBAL VARIABLES

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

0