Display my sensor's output with Uart coding

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 0654wil
    New Member
    • Dec 2011
    • 5

    Display my sensor's output with Uart coding

    Hi,

    I am trying to display my sensor's output (HEX to ASCII output type) onto the hyperterminal program through UART coding.

    To display the fluctuations of the sensor when something is covering it etc. The hyperterminal listed a list of fluctuation values eg,

    "Sensor 1

    01CD
    01BA
    0106 "

    But what I want is " 01CD > 01BA > 0106 ". To show real-time fluctuations instead of showing the a list of the changes in values, which spammed my hyperterminal.

    What changes should I do to my UART codes so that it would just display the fluctuation changes and not display a list of values?

    Sorry for the poor grammer.
  • donbock
    Recognized Expert Top Contributor
    • Mar 2008
    • 2427

    #2
    Do I understand your situation properly?
    • Your program reads a sensor and then transmits the value of the sensor out a serial port using a UART every time the value changes.
    • A cable connects your machine to a PC.
    • The PC uses hyperterminal to display the messages transmitted by your program.
    • You are currently sending newline after each sensor value; but you instead want to withhold the newline until you have sent some number of sensor values.

    Presumably you are sending the sensor values as ASCII strings rather than as binary values because otherwise it would make no sense to say you want to separate the values with the ">" character. You must be constructing that string, so it should be straightforward to always precede or follow [your choice] the value with a separator character.

    You want to remove the unconditional newline after each value and instead keep count of the number of values sent on the current line and only send newline when that count reaches the desired threshold.

    You will need to configure this serial port for unbuffered output.

    Comment

    • 0654wil
      New Member
      • Dec 2011
      • 5

      #3
      Thanks for your reply!

      Yes! I'm connecting a hardware to the PC. So basically my hardware is a circuit board with my sensors and the hyperterminal shows my output.

      I wanted the output display to just show the output fluctuations like this
      gif animation maker
      instead of like this,
      Sensor 1
      01CD
      01BA
      0106
      0101
      01D6
      01C5 <- current value shown
      .
      .
      .

      So I have to configure the codes for the serial port?

      Comment

      Working...