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

Problem caused by data type?

I am using Analog Device ADuC848, which has 4 kbyte on-chip nonvolatile data flash. Because each page of this data memory has 4 bytes, so I define

typedef struct
{
  UINT8 value;
  UCHAR unused[3];
} NVM_SingleByte_T;

I use quite a lot of NVM_SingleByte_T to define variables throughout my program.
Now I have a very strange problem. A subroutine as below:

void cmdhandler(void)
{NVM_SingleByte_T tmpByte;
tmpByte.value = 1; }


this routine will trigger my relay which is controlled by GPIO. And if I change tmpByte.value to other number not equal to 1, it will not trigger relay. This cmdhandler has nothing to do with relay control, so how come this local variable affecting other part of my program?
Thanks in advance