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

ASCII

How to input ASCII values coming from serial.

E.g if 8-bit ASCII code '80' of alphabet P, or 8-bit ASCII code '49' of digit 1 is recieved at serial port, how do I input this ASCII.

Parents
  • thanks..
    But I want to ask one more thing...

    When I recieve 49, do I recieve 1 or the ASCII 49. I mean to say that if I want to compare the value recieved how can I do that,..

    char recieved_char;
    recieved_char='SBUF';
    if(recieved_char==49)
    {
    .
    .
    }

    "OR"


    char recieved_char;
    recieved_char = SBUF;
    if(recieved_char==1)
    {
    .
    .
    }


    OR


    char recieved_char;
    recieved_char = SBUF;
    if(recieved_char=='1')
    {
    .
    .
    }

Reply
  • thanks..
    But I want to ask one more thing...

    When I recieve 49, do I recieve 1 or the ASCII 49. I mean to say that if I want to compare the value recieved how can I do that,..

    char recieved_char;
    recieved_char='SBUF';
    if(recieved_char==49)
    {
    .
    .
    }

    "OR"


    char recieved_char;
    recieved_char = SBUF;
    if(recieved_char==1)
    {
    .
    .
    }


    OR


    char recieved_char;
    recieved_char = SBUF;
    if(recieved_char=='1')
    {
    .
    .
    }

Children