serial communication

Discussion in 'Computing and Networks' started by Ameer ul haq, Mar 28, 2015.

  1. Ameer ul haq

    Thread Starter New Member

    Mar 19, 2015
    11
    1
    May anyone help me how serial communication circuit knows that the input from PC is alphabet or numeric alue?
     
  2. MrChips

    Moderator

    Oct 2, 2009
    12,452
    3,371
    We frown on hijacking of old threads.
    Your post has been moved to a thread on its own.
     
  3. MrChips

    Moderator

    Oct 2, 2009
    12,452
    3,371
    The PC does not know the difference between text or binary information.

    The programmer has to choose how the information is encoded in the transmitted data.

    All data transmitted is binary.
     
  4. Papabravo

    Expert

    Feb 24, 2006
    10,179
    1,800
  5. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,571
    2,381
    Usually ASCII is used to transmit alpha/numeric as only 7 bits can be used, with binary value's, it is normal to use the full 8 bits, for RS232/RS485 anyway.
    The TX & RX end have to use the same protocol in order to receive valid data.
    Max.
     
  6. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,699
    907
    I cannot speak for a real PC, but I suspect the following answer applies to them as well.

    Take Papabravo's example of 0X41. That is hex for the binary number 01000001. It is also hex for the ASCII value "A" or the decimal value of 65. The term radix describes whether you are using hex, decimal, ascii, octal, or binary. Now, if you send the binary equivalent (01000001) via serial to a typical LCD monitor, it will show an "A", because the radix for such monitors is set ASCII.

    If you want that monitor to show the number "65", you have to send the binary numbers for the ascii equivalents of a "6" and of "5." Conveniently, the conversion from decimal number to ascii can be done by adding decimal 48. Thus, you need to send the value 54 in binary (6+48 = 54) and then 53 in binary.

    Now, let's assume that instead of sending to a typical monitor, you are sending to a small microcontroller. The program of that microcontroller can be set to interpret a serial communication by whatever radix you chose. So, you can set that program to use an 8-bit binary byte for 54 (b'00110110') as the decimal value "54".

    John

    Edit: Corrected the binary for 0X41. Thank you Papabravo.
     
    Last edited: Mar 28, 2015
  7. Papabravo

    Expert

    Feb 24, 2006
    10,179
    1,800
    Your binary for 0x41 should read 01000001
     
Loading...