Shop OBEX P1 Docs P2 Docs Learn Events
Serial strings and variables — Parallax Forums

Serial strings and variables

ArchiverArchiver Posts: 46,084
edited 2004-03-22 23:51 in General Discussion
I want to change the Speakjet chip's oscillator's frequency value
using a sensor and Basic stamp 2. So I need to send it variables and
strings, because the SCP (serial control protocol) of the speakjet
chip needs values and letters (ex: 1J500N is oscillator 1 at 500Hz).
Sending one after the other doesn't work:
SEROUT 15,$0054,[noparse][[/noparse]"\08J0N1J"]
SEROUT 15,$0054,[noparse][[/noparse]result]
SEROUT 15,$0054,[noparse][[/noparse]"N"]
and sending both at once doesn't either:
SEROUT 15,$0054,[noparse][[/noparse]result,"N"]

Has anybody done something dynamic with BS2 and speakjet's SCP ?? Or
am I not understanding something with Pbasic 2.5?

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-03-22 23:27
    --- In basicstamps@yahoogroups.com, "bobtoton" <hugodini@w...> wrote:
    > I want to change the Speakjet chip's oscillator's frequency value
    > using a sensor and Basic stamp 2. So I need to send it variables
    and
    > strings, because the SCP (serial control protocol) of the speakjet
    > chip needs values and letters (ex: 1J500N is oscillator 1 at
    500Hz).
    > Sending one after the other doesn't work:
    > SEROUT 15,$0054,[noparse][[/noparse]"\08J0N1J"]
    > SEROUT 15,$0054,[noparse][[/noparse]result]
    > SEROUT 15,$0054,[noparse][[/noparse]"N"]
    > and sending both at once doesn't either:
    > SEROUT 15,$0054,[noparse][[/noparse]result,"N"]
    >
    > Has anybody done something dynamic with BS2 and speakjet's SCP ??
    Or
    > am I not understanding something with Pbasic 2.5?


    What about:
    SEROUT 15,$0054,[noparse][[/noparse]DEC result]

    I guess 'result' is a variable, and you want to send it in numeric
    value? Then use DEC or DEC2 if it's two digits or DEC3 or DEC4 (max
    four digits)
  • ArchiverArchiver Posts: 46,084
    edited 2004-03-22 23:51
    Use the DEC modifier:

    SEROUT 15, $0054, [noparse][[/noparse]DEC result]

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office


    Original Message
    From: bobtoton [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=cyWrGwtw9FxXaUxPZUKZ4nMdczh7VEwggfE8KRdC7eeLJmtk3EdaCAci1TDDFMoX2UjUQSMXrX3mUz1YoYu3Hw]hugodini@w...[/url
    Sent: Monday, March 22, 2004 3:20 PM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] Serial strings and variables


    I want to change the Speakjet chip's oscillator's frequency value
    using a sensor and Basic stamp 2. So I need to send it variables and
    strings, because the SCP (serial control protocol) of the speakjet
    chip needs values and letters (ex: 1J500N is oscillator 1 at 500Hz).
    Sending one after the other doesn't work:
    SEROUT 15,$0054,[noparse][[/noparse]"\08J0N1J"]
    SEROUT 15,$0054,[noparse][[/noparse]result]
    SEROUT 15,$0054,[noparse][[/noparse]"N"]
    and sending both at once doesn't either:
    SEROUT 15,$0054,[noparse][[/noparse]result,"N"]

    Has anybody done something dynamic with BS2 and speakjet's SCP ?? Or
    am I not understanding something with Pbasic 2.5?




    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject
    and Body of the message will be ignored.

    Yahoo! Groups Links







    This message has been scanned by WebShield. Please report SPAM to
    abuse@p....
Sign In or Register to comment.