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

Cannot copy values from code array to another array which is a struct member (both global)

I have the following variables:


#define X ...
...
code unsigned char pin[X] = { ... }; // there are values here, no 0xFF
...
struct {
  unsigned char pin[X];
} info;


and I need to copy the values from pin into info.pin. However, even direct assignment doesn't change the info.pin values. i.e.:

info.pin[0] = pin[0];
info.pin[1] = pin[1];
info.pin[2] = pin[2];
...
info.pin[X - 1] = pin[X - 1];


the watch window shows info.pin values are still 0xFF and indeed when another code that needs info.pin checks (after the assignment above of course), the values are still 0xFF. What do I have to do to make the values copied?

Parents
  • Are you sure you can edit a 'code' variable??

    He is reading the contents of 'code' variable and writing it to 'ram' variable.

    You need to look at some disassembly for the piece of code to see what the compiler is making.

Reply
  • Are you sure you can edit a 'code' variable??

    He is reading the contents of 'code' variable and writing it to 'ram' variable.

    You need to look at some disassembly for the piece of code to see what the compiler is making.

Children