Shop OBEX P1 Docs P2 Docs Learn Events
Displaying the value of a variable using Serout — Parallax Forums

Displaying the value of a variable using Serout

edited 2010-04-21 01:44 in Propeller 1
I have any easy question using Serout in PBasic.
There·is no·problem displaying a string via RS232 to Hyperterminal·but I have been unable to display a value of a variable.
What am I missing?

Thanks.
·

Comments

  • MagIO2MagIO2 Posts: 2,243
    edited 2010-04-20 19:30
    Hyperterminal is a program meant for transfering text via serial interface. That's why there is no problem in reading strings sent by the propeller. A value of a variable is not a string, it's a byte, a word or a long meant to hold a digital representation of a number. If you want to view the content of a variable you have to translate it to a string.
    I don't know PBasic, but in other serial interface drivers you have functions like hex or dec which take a number and send the hexadecimal or decimal representation of this number.
  • Gerry KeelyGerry Keely Posts: 75
    edited 2010-04-20 19:32
    Hi



    Have a look at this thread···· http://forums.parallax.com/showthread.php?p=892641

    regards

    Gerry
  • sylvie369sylvie369 Posts: 1,622
    edited 2010-04-20 19:43
    The Numbers and Simple Numbers objects in the OBEX have methods for converting numbers to strings and vice-versa.
  • edited 2010-04-20 19:58
    Thanks for the fast reply.
    I'll follow up on these leads.
  • StefanL38StefanL38 Posts: 2,292
    edited 2010-04-21 01:44
    serout is a poor command compared to the commands provided by the Extended_FD_Serial-driver in the obex.

    it may take an hours to understand the commands but then sending a number is done by just calling

    serial.dec(1234)

    or serial.dec(MyVariable)

    want to see the numbers binary in hypertext like this "01100111"?

    just use

    serial.bin(MyVar,8)

    best regards

    Stefan
Sign In or Register to comment.