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

error: "USB.C(268): error C213: left side of asn-op not an lvalue"

hello
i got the following error message after compilation:
"USB.C(268): error C213: left side of asn-op not an lvalue"

it seems to be not that difficult, but i'm running out of time with my project and cant see the possible reason.
thanks for your help

code:

void TD_Poll(void)             // Called repeatedly while the device is idle
{
   unsigned char testbuffer[64];
   unsigned char testbuffer_old[64];

   if(testbuffer != testbuffer_old) /only write testbuffer to ram if it changed
   {

   FIFORead(testbuffer);
   WriteToHPIA(0x10041000);
   FIFOWrite(testbuffer);
   testbuffer_old = testbuffer; //error here
   }
}

  • Do you understand what an 'lvalue' is?
    If not, check in your 'C' textbook!

    testbuffer_old = testbuffer; //error here
    

    What is the type of testbuffer_old ?
    What is the type of testbuffer ?
    Does 'C' support assignment between these types...?

  • "it seems to be not that difficult, but i'm running out of time with my project and cant see the possible reason."

    Yes, sometimes when we're under pressure we can't see the obvious things!

    That's when it can really pay to take a break!

    Even though you're under pressure of time, take a break: go for a walk, have a cigarette, whatever helps you most. It will be time well spent.

  • while I do not argue agains Andy's suggestion above, I have found that, for me, taking a break does not work, while doing something else does. When taking a break, my brain continue churning on the problem, whereas if I do something else, it switches. Another thing that often works for me is leaving it till tomorrow.

    Erik