+ Post New Thread
Results 1 to 5 of 5
  1. #1
    Full Member level 4
    Points: 1,776, Level: 9

    Join Date
    Sep 2014
    Location
    india
    Posts
    218
    Helped
    1 / 1
    Points
    1,776
    Level
    9

    8051 UART serial communication.

    Dear All,
    I want to send & recieve decimal numbers from UART of 8051.but i don't know how to use sbuf register & other coding of uart.please help.
    Thanks,
    Tepu

    •   AltAdvertisment

        
       

  2. #2
    Super Moderator
    Points: 73,677, Level: 66
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    14,949
    Helped
    3403 / 3403
    Points
    73,677
    Level
    66

    Re: 8051 UART serial communication.

    Hi,

    You say "decimal numbers"
    A UART transmit is byte wide. Usally 8 bits of data.
    You may see/treat those 8 bits as
    * one character ASCII coded
    * an unsigned integer value with range 0...255
    * a signed integer value with range -128...0...+127
    * two nibbles of BCD with range of "00" ... "99"

    If you are not satisfied with this you need to send multiple bytes representing
    * 2 bytes unsigned integer with range 0...65535
    * 2 bytes signed integer with range -32768 ... 0 ... +32767
    ... or any other byte count integers ....
    ... or (multi byte) floating point
    ... or (multi byte) fixed point
    ... or (multi byte) string
    ... or (multi byte) BCD
    ... or many other representations

    If you want to get a recommendation how to transmit your "decimal value" then you first should specify it's range and resolution (or number of fractional decimals)..

    Klaus
    Please don´t contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



    •   AltAdvertisment

        
       

  3. #3
    Member level 5
    Points: 1,439, Level: 8

    Join Date
    Jun 2017
    Location
    Bhubaneswar,Odisha,India
    Posts
    90
    Helped
    4 / 4
    Points
    1,439
    Level
    8

    Re: 8051 UART serial communication.

    which micro controller you are using of 8051 ?
    and in which language you are coding , assembly or c ?

    the moment you place data on sbuf register ,it start sending or receiving, you simply need to monitor RI or TI FLAG to the transmission and reception is completed.



    •   AltAdvertisment

        
       

  4. #4
    Full Member level 4
    Points: 1,776, Level: 9

    Join Date
    Sep 2014
    Location
    india
    Posts
    218
    Helped
    1 / 1
    Points
    1,776
    Level
    9

    Re: 8051 UART serial communication.

    Thank you for reply,
    I am using 89S52.I use c language in coding.



  5. #5
    Advanced Member level 5
    Points: 9,012, Level: 22
    Achievements:
    7 years registered
    Easyrider83's Avatar
    Join Date
    Oct 2011
    Location
    Tallinn, Estonia
    Posts
    1,588
    Helped
    362 / 362
    Points
    9,012
    Level
    22

    Re: 8051 UART serial communication.

    char buffer[20];
    sprintf(buffer, "Value = %u", value);
    uart_send(buffer);
    Love me or hate me. All infractions will be ignored.



--[[ ]]--