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

rfreader

#include<reg51.h>
void boud_rate()
{
        SCON = 0x50;
        TMOD = 0x20;                /* timer 1, mode 2, 8-bit reload */
        TH1  = 0xFD;                /* reload value for 2400 baud */
        TR1  = 1;
        TI   = 1;
}
char serial_receive()
{
    char chr;        /* variable to hold the new character */
        while (RI != 1) {;}
        chr = SBUF;
        RI = 0;
        return(chr);
}

void main(void)
{

        boud_rate();
  unsigned char rx_data;

  for(;;)
  {
    rx_data = serial_receive();

    switch(rx_data)
    {
//      case '1': open_door();
          case 0067892341 : open_door();
        break;
//      case '9': open_door();
       case 0045780034 : open_door();
        break;

      default: dont_open();
    }

    proper_delay();
  }
}

errors

'rx_data':undefined identifier
 illigal octal digit

please tell me how to overcum these errors

Parents
  • for (i = 0; i < ACCEPTABLE_INPUT_COUNT; i++) {
        j = strcmp(acceptable_inputs[i],input);
           if(j==0)
           break;
         }
        if (j==0) {
            lcd_printxy(1,8,"yes");
            input_pos=0;
        } else {
            lcd_printxy(1,1,"no");
            input_pos=0;
        }
    

    as you said i am getting problem in this part of code. it is receiving all the characters but not able to compare, it is printing "no" on the lcd.. i am not able find out why it is happening so, Sir please help me out. which step of the above code should be corrected.

Reply
  • for (i = 0; i < ACCEPTABLE_INPUT_COUNT; i++) {
        j = strcmp(acceptable_inputs[i],input);
           if(j==0)
           break;
         }
        if (j==0) {
            lcd_printxy(1,8,"yes");
            input_pos=0;
        } else {
            lcd_printxy(1,1,"no");
            input_pos=0;
        }
    

    as you said i am getting problem in this part of code. it is receiving all the characters but not able to compare, it is printing "no" on the lcd.. i am not able find out why it is happening so, Sir please help me out. which step of the above code should be corrected.

Children