Shop OBEX P1 Docs P2 Docs Learn Events
String question — Parallax Forums

String question

BTXBTX Posts: 674
edited 2006-11-29 01:27 in Propeller 1
Hi.
I'm getting crazy with this simple problem.

This works fine.
BTX said...

CON
· _clkmode = xtal1 + pll16x
· _xinfreq = 5_000_000


OBJ
· tv········· : "tv_text"

PUB Ftest
··· tv.start(12)····························································· '···· Start the tv terminal
··· tv.str(string($0C,3,"It's beggining the test........ ",13))··········································· '····
··· tv.str(string($0C,3,"It's finishing................. ",13))
··········································· '····

and why·this NOT ???????
BTX said...
CON
· _clkmode = xtal1 + pll16x
· _xinfreq = 5_000_000


OBJ
· tv········· : "tv_text"


PRI Doing(texto)
··· tv.start(12)····························································· '···· Start the tv terminal
··· tv.str(string($0C,3,texto,13))··········································· '····


PUB Ftest
··· Doing("A")
··· Doing("B")
···
Regards
Alberto.
·

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2006-11-28 18:37
    Alberto,

    See this thread: http://forums.parallax.com/showthread.php?p=617756

    -Phil
  • BTXBTX Posts: 674
    edited 2006-11-28 19:23
    Thanks Phil.
    But in Scott example ...he want o show a dec in the same way that a string...I want to replace a full string expression, with a new one form, that let me to send to TV a directly formated string (carrieage returm plus colors, in a simple form like Doing("xxxxx")).
    Which is the base problem to pass a string variable, as string in the TV object?

    Regards.
    Alberto.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2006-11-28 19:36
    It's the same issue: you can't use a variable in the string function, since the string is "built" at compile time. However, you can make a separate call to tv.str with just your variable as an argument. (I assume your variable contains the address of a zero-terminated string.)

    -Phil
  • HarleyHarley Posts: 997
    edited 2006-11-28 19:38
    TV_text is being used. How does one display the ASCII of a received byte?___

    It seems to provide display of string, dec, hex, bin. Am I not using the proper object to display characters?___

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Harley Shanko
    h.a.s. designn
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2006-11-28 19:40
    Q: How does one display the ASCII of a received byte?

    A: text.out(x)

    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Martin Hebel
    StampPlot - Graphical Data Acquisition and Control
    AppBee -·2.4GHz Wireless Adapters & transceivers·for the BASIC Stamp & Other controllers·
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2006-11-28 19:41
    Harley,

    Use the out function. It will display a single character as ASCII.

    -Phil
  • BTXBTX Posts: 674
    edited 2006-11-28 20:06
    Phil said...
    It's the same issue: you can't use a variable in the string function, since the string is "built" at compile time. However, you can make a separate call to tv.str with just your variable as an argument. (I assume your variable contains the address of a zero-terminated string.)
    Sorry Phil... I'm trying to pass my variable as argument, it's not clear for me, how ??
    Separate call....is not my Doing() ??
    If I can't put a variable into the string command, how to pass my variable value to it ??
    I insist because, I think i could get the same problem in the future, when I'll try to use an existing object.
    Could you brieftly, write for me a couple of code, to show me what you want to say ?

    Thanks again...
    Alberto.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2006-11-28 20:24
    Hi alberto,

    Sure. Try this:

    PUB Ftest
        tv.start(12)
        Doing("A")
        Doing("B")
    
    PRI Doing(texto)
        tv.str(string($0C,3))
        tv.[b]out[/b](text0)
        tv.out(13)                                 
     
    
    



    If you were using strings instead of single characters, you'd do something like this:

    PUB Ftest
        tv.start(12)
        Doing(string("It's doing A."))
        Doing(string("It's doing B."))
    
    PRI Doing(texto)
        tv.str(string($0C,3))
        tv.[b]str[/b](text0)
        tv.out(13)                                 
     
    
    



    Also, notice that I moved the call to start so it would only be executed once.

    -Phil
  • BTXBTX Posts: 674
    edited 2006-11-29 01:27
    Oh !! thanks so much Phil for your help.

    Now I understand, what you want to say, and it's working fine...
    It' very clear, tv.str accept the variable 'texto', but without the command 'string', then you put it after the Doing, if you want to show more than one character.

    I think I'm getting a bit older........too much Java, C++, VB, VFP, MASM, etc.etc. no more RAM available in my mind perhaps.mad.gif

    Regards.
    Alberto.
Sign In or Register to comment.