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

    Join Date
    Sep 2014
    Location
    india
    Posts
    214
    Helped
    1 / 1
    Points
    1,681
    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: 69,411, Level: 64
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    14,176
    Helped
    3237 / 3237
    Points
    69,411
    Level
    64

    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,359, Level: 8

    Join Date
    Jun 2017
    Location
    Bhubaneswar,Odisha,India
    Posts
    89
    Helped
    4 / 4
    Points
    1,359
    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,681, Level: 9

    Join Date
    Sep 2014
    Location
    india
    Posts
    214
    Helped
    1 / 1
    Points
    1,681
    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: 8,870, Level: 22
    Achievements:
    7 years registered
    Easyrider83's Avatar
    Join Date
    Oct 2011
    Location
    Tallinn, Estonia
    Posts
    1,567
    Helped
    358 / 358
    Points
    8,870
    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.



--[[ ]]--