• Switch/Case in I2C interrupt
    Hi, I am using C8051F005 as I2C slave. In the I2C interrupt, there is switch/case statement to load SMB0DAT with data to be output based on the OP_CODE. There are 15 cases. The master will get wrong...
  • Trouble in "SWITCH" case
    Dear all iam having problem with SWITCH case switch(aaa) { case '1': LIGHT=1; printf("Light On\n"); break; case '2': LIGHT=0; printf("Light Off\n"); break; case '3': printf("Unknown...
  • Switch Case Statement problem
    I am using switch statement as follows uint16 val; switch (val) { case 0x0000: ... break case 0x0001: ... break case 0x0000: ... break case 0x0000: ... break case 0x0000: ... break...
  • Switch / Case Optimization
    I've read through this thread: http://www.keil.com/forum/8020/ and I understand that: 1. For "a few" case values, I'll get a series of if / else if's. Not sure how many that is. 2. If the case...
  • switch case fail
    void xx(char cc) { char aa; switch(cc) { case 1:case 0: aa=1; break; case 2,3: aa=2; break; } } //---------------------------------- xx(0); //run OK xx(1); //run OK xx(2); //run FAIL <<*...