Shop OBEX P1 Docs P2 Docs Learn Events
SayIt Module GUI's Programming Program for BS2 — Parallax Forums

SayIt Module GUI's Programming Program for BS2

xanatosxanatos Posts: 1,120
edited 2011-07-06 06:46 in BASIC Stamp
I'm wondering if there is some place where I can find the "programming program" (I think it's referred to as the "Bridge Program") that the stamp runs when you train it with the SayIt GUI? I want to add it as a slot in my voice controlled home automation system (with some modifications) so I can change commands/retrain in-circuit.

Thanks!


PS., I checked the code in the SayIt GUI's data folder, and found several items, but none appear to have the bridge program functions (although RN1 looks pretty interesting - a very substantial robot control program!) So... still looking for that Bridge Program code!
' {$STAMP BS2sx}
' {$PBASIC 2.5}

' COM Parameters
COM_RX PIN 0 ' rx pin
COM_TX PIN 2 ' tx pin
COM_SPEED CON 240 ' baud 9600
COM_10MS CON 25 ' 10ms unit

' Protocol Command
CMD_BREAK CON "b" ' abort recog or ping
CMD_SLEEP CON "s" ' go to power down
CMD_KNOB CON "k" ' set si knob <1>
CMD_LEVEL CON "v" ' set sd level <1>
CMD_LANGUAGE CON "l" ' set si language <1>
CMD_TIMEOUT CON "o" ' set timeout <1>
CMD_RECOG_SI CON "i" ' do si recog from ws <1>
CMD_RECOG_SD CON "d" ' do sd recog at group <1> (0 = trigger mixed si/sd)

' Protocol Status
STS_AWAKEN CON "w" ' back from power down mode
STS_ERROR CON "e" ' signal error code <1-2>
STS_INVALID CON "v" ' invalid command or argument
STS_TIMEOUT CON "t" ' timeout expired
STS_INTERR CON "i" ' back from aborted recognition (see 'break')
STS_SUCCESS CON "o" ' no errors status
STS_RESULT CON "r" ' recognised sd command <1> - training similar to sd <1>
STS_SIMILAR CON "s" ' recognised si <1> (in mixed si/sd) - training similar to si <1>

' Protocol arguments are in the range 0x40 (-1) TO 0x60 (+31) inclusive
ARG_MIN CON 64 ' 0x40
ARG_MAX CON 96 ' 0x60
ARG_ZERO CON 65 ' 0x41

ARG_ACK CON 32 ' 0x20 'TO READ more status arguments
........

Comments

  • xanatosxanatos Posts: 1,120
    edited 2011-07-05 15:47
    OK, I'm just going to give this a quick bump for one last crack at finding out where to obtain a copy of the SayIt GUI's "Bridge Program" that it downloads to the Stamp when training it with your user-defined commands... just the .bsx or .bs2 or .bs file. SOMEONE on here must have a copy of it! :-)

    Thanks,

    Dave
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-07-05 16:20
    The bridge program just passes data to and from the computer and Say It module. I made a bridge for the Propeller chip. The default baud is 9600.

    I haven't use the Basic Stamp for several years so I don't know of to write the program in Pbasic. I don't think it would be hard.

    Duane
  • xanatosxanatos Posts: 1,120
    edited 2011-07-05 17:22
    Thanks - I'll take a look at the link you've given, but I'm not sure if I can quite understand the prop code yet... I can do anything with PBasic, but I'm still at absolute beginner with spin.

    Dave
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-07-05 19:40
    I don't remember how the serin and serout work. Which is strange since the ease of serial communication was the thing I initially missed most about the Stamp.

    You want to check for serial input from both the computer and the Say It. Any input received gets outputted to the other device.

    You want to translate this part in to PBasic. I've added some comments to hopefully make it easier to understand. Com[0] is used to communicate with the PC. Com[1] is used to communicate with the Say It.
      repeat
        result := Com[0].rxcheck
        ' result is a temp variable.  It hold one character returned by the Com object.
        ' In this case the Com object is monitoring the line to the computer.
        ' if no new character have been received a -1 is returned.
        ' Sometime zero's show up when they're not supposed to so I also excluded zeros.
        ' The Say It doesn't use zero in any of its protocol.
        ' If the character isn't negative one or zero then I send it to the Say It module.
        if result <> -1 and result <> 0
          Com[1].tx(result) ' This line sends the character received from the computer to the Say It.
        result := Com[1].rxcheck ' now check to see if the Say It has transmitted a character.
        if result <> -1 and result <> 0
          Com[0].tx(result) ' send character from Say It to computer.
    

    Technically, you don't need the computer to reprogram the Say It. All the commands the computer issues to the Say It could be issued from a uC.

    Duane
  • xanatosxanatos Posts: 1,120
    edited 2011-07-06 06:46
    Thanks... OK, so that makes sense - just SEROUT to one anything that I SERIN from the other. I'm guessing that this will also work for the full functions of the GUI, so that if I wish to rename a command, clear its training, and retrain it, this conception of the bridge program will handle all of that just fine?

    And I agree on the "ease of serial communications" thing - I have been so thoroughly spoiled by SERIN and SEROUT that it was a shock to me when I found out that I had to include entire propeller objects like Full Duplex Serial to handle something I could do in a single line with the stamp. Even though I recognize that the Stamp, in reality, has it's equivalent of FDS built in as code somewhere, my mind started thinking that I could wind up filling up the prop's entire memory with the stuff I needed to include! :-) But now I have seen the complexity of what the prop can handle, and I'm hooked - but still kind of feeling my way through clumsily.

    Thanks for this info, I hope to be able to test it out soon (I'm away for a few days).

    Dave
Sign In or Register to comment.