Shop OBEX P1 Docs P2 Docs Learn Events
Terminal serial — Parallax Forums

Terminal serial

kaydarakaydara Posts: 17
edited 2013-02-08 16:51 in Accessories
Greetings, my question is: can the serial terminal software display float numbers, for example (0.30 or 2.3). thank you very much in advance.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2013-02-05 10:52
    The serial terminal software (Parallax Serial Terminal or equivalent) just displays characters. It doesn't do the conversion from some kind of internal number format to characters. 0.30 is just the characters "0",".","3","0" and 2.3 is just the characters "2",".","3". If you're using a Propeller for the microprocessor, there are floating point objects available, one that does the actual calculations in floating point and another that will convert the internal floating point values to character strings that can be sent to some kind of display. If you're using a Stamp, that is really inadequate to do floating point unless you use some kind of external arithmetic processor like this one that does the floating point to string conversion as well. You can easily do fixed point scaled arithmetic where you might have a variable where 0.30 is represented as an integer 030. It's easy to display that sort of scaled value in a more readable format by using something like this where X is the 16-bit unsigned scaled value (0.00 to 655.35):

    SEROUT <I/O pin>,<Baud constant>,[DEC X/100,".",DEC2 X//100]
  • kaydarakaydara Posts: 17
    edited 2013-02-08 16:51
    Mike Green wrote: »
    The serial terminal software (Parallax Serial Terminal or equivalent) just displays characters. It doesn't do the conversion from some kind of internal number format to characters. 0.30 is just the characters "0",".","3","0" and 2.3 is just the characters "2",".","3". If you're using a Propeller for the microprocessor, there are floating point objects available, one that does the actual calculations in floating point and another that will convert the internal floating point values to character strings that can be sent to some kind of display. If you're using a Stamp, that is really inadequate to do floating point unless you use some kind of external arithmetic processor like this one that does the floating point to string conversion as well. You can easily do fixed point scaled arithmetic where you might have a variable where 0.30 is represented as an integer 030. It's easy to display that sort of scaled value in a more readable format by using something like this where X is the 16-bit unsigned scaled value (0.00 to 655.35):

    SEROUT <I/O pin>,<Baud constant>,[DEC X/100,".",DEC2 X//100]


    Mr Mike thank you very much for your reply, is exactly what I was looking for.
Sign In or Register to comment.