Shop OBEX P1 Docs P2 Docs Learn Events
How to display an integer variable on TV — Parallax Forums

How to display an integer variable on TV

ElectricAyeElectricAye Posts: 4,561
edited 2008-08-25 19:25 in Propeller 1
Hi,
I've been using the TV_Text object to debug some code, and I've got it to work for outputting a decimal temperature, but I can't seem to find the right function for outputting an integer. There's next to no comments on the TV_Text object, so I'm lost. Can somebody give me a clue how to take a variable that is full of counted events, Frequency1, and get it to display as an integer?

thanks,
Mark

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It might be the Information Age but the Eon of Ignorance has yet to end.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-08-25 19:14
    Generally, all of the display objects, whether for TV or VGA or LCDs or even for serial I/O, provide a DEC method which takes an integer argument and converts it to an equivalent sequence of decimal digit characters and ships it to the involved device. Similarly, there's usually a HEX method and sometimes a BIN method which convert the integer to hexadecimal digits or binary digits with a digit count specified. Some I/O objects have a fixed width decimal conversion method, but most only provide the variable width method.
  • ElectricAyeElectricAye Posts: 4,561
    edited 2008-08-25 19:22
    Thanks, Mike,
    I see that there is a DEC method in TV_TEXT. I plugged my variable into it like this

    Debug.Dec(Frequency1)

    but the compiler said it was looking for an expression term and highlighted my variable.

    Any reason it would do that?

    Mark

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    It might be the Information Age but the Eon of Ignorance has yet to end.
  • ElectricAyeElectricAye Posts: 4,561
    edited 2008-08-25 19:25
    Oops, I found the problem. I had not yet declared that variable in the VAR statement.

    Thanks Mike!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    It might be the Information Age but the Eon of Ignorance has yet to end.
Sign In or Register to comment.