Shop OBEX P1 Docs P2 Docs Learn Events
V-Stamp repeats old phrase after changing text — Parallax Forums

V-Stamp repeats old phrase after changing text

FalconFalcon Posts: 191
edited 2011-11-16 08:42 in BASIC Stamp
I'm using Xanatos's Starter code with a few changes for baud and I/O pins. However, it repeats the previous phrase after typing in a new one:
'   {$STAMP BS2px}
'   {$PBASIC 2.5}
'
' -----[ I/O Definitions ]-------------------------------------------------

VTX             PIN     4               ' TX pin on BS2 to V-Stamp RXD - pin 20
VRX             PIN     5               ' RX pin on BS2 to V-Stamp TXD - pin 19
CTS             PIN     6               ' Clear to Send on VS- pin 21
'SUSP            PIN     3               ' Suspend on VS - pin 23 (Hardwire VS to H if not used)
'STBY            PIN     4               ' Standby on VS - pin 22 (Hardwire VS to H if not used)

' -----[ Constants ]-------------------------------------------------------

Baud            CON     396             ' 9600 bps (BS2sx)

' -----[ Variables ]------------------------------------------------------

' -----[ Initialization ]--------------------------------------------------
'Command Notes:  O=Orator (0-10O); S=Speed (0-13S); A=Articulation (0-9A); E=Expression (0-9E); F=Frequency (0-99F); P=Pitch (0-99P); X=Tone (0X-2X); R=Reverb (0-9R)
'Orators: 0: Perfect Paul; 1: Vader; 2: Big Bob; 3: Precise Pete; 4: Ricochet Randy; 5: Biff; 6: Skip; 7: Robo Robert; 8: Goliath; 9: Alvin; 10: Gretchen.

'                                                    orator        speed     articulation  expression    freq           pitch         X-Tone        reverb
IF CTS = 0 THEN
  SEROUT VTX, Baud, [CR, CR, 01, "2O", 01, "1S", 01, "1A",     01, "2E",   01,     "75F",  01, "45F", 01, "2X", 01,      "2R",  CR]      ' Send Command To V-Stamp - proceed with CR to lock baud rate!
ENDIF

PAUSE 2000

' -----[ Program Code ]----------------------------------------------------

Main:

IF CTS = 0 THEN SEROUT VTX, Baud, [CR, "Garage Door Open"]      ' Send Command To V-Stamp - proceed with CR to lock baud rate!
DEBUG HEX CTS


END
The strange thing is that after I change the text to a different phrase, the next time I RUN the code it repeats the previous phrase. If I make no changes and RUN the code again, it will then "speak" the new phrase. It will always speak the older code one time after changing the text to something different.

Anyone entounter this? Or have any advise?

falcon

Comments

  • xanatosxanatos Posts: 1,120
    edited 2011-11-13 19:36
    Hi Falcon,

    I'm only on my iPod Touch now and I have no scrollbars on your code, but I will look at it when I'm back at my regular computers.

    From what you describe though, I would say it sounds like the new code doesn't get read in to your v-stamp at the right place in the program. I've done similar things in other programs. My guess is that if you really sit and walk through your code, actually run it step by step in your head, you'll find why it seems one phrase behind each time. That's what I'll be doing when I look at your code...

    Good luck!

    Dave
  • FalconFalcon Posts: 191
    edited 2011-11-14 04:40
    I appreciate the help. Can you give me some general guidance/logic as to how I would determine where that initialization line should go, and how often it needs to be included. Can I just place it once in the Slot 1 Initialization section (with the RTC) or does it have to run immediately prior to each text string being sent to the V-Stamp?

    Also, have you ever had the speech from the V-Stamp have an echo? In the process of troubleshooting this, I began to here a distinct echo of every spoken work. I would estimate about 200-300 mSeconds.

    falcon
  • RiJoRiRiJoRi Posts: 157
    edited 2011-11-15 06:40
    As to the "echo," could this be the reverb??

    You have code that tests for CTS = 0. What happens if CTS = 1? I'd add traps before the two IF statements. Experience has shown me that "It will never happen" means "It will happen at the worst possible time!"

    I'm not familiar with the hardware, but one possible reason for the effect you are seeing is that the first time you run the code, there is nothing in the voice chip's buffer, so it says nothing until the buffer is loaded in the main loop. The sentence is maintained, then when you re-initialize the voice chip, there is something in the buffer so it says that. This is definitely a WEG -- Wild-Eyed Guess, but something like this should be covered in the Fine Manual.

    --Rich
  • graffixgraffix Posts: 389
    edited 2011-11-15 06:53
    Hi falcon, think you could put some pics up of how you have the v stamp boarded.I've had mine on the bench for awhile now.I don't wanna mess it up.I know others have a lot of interest in them also.Please and thanks
  • FalconFalcon Posts: 191
    edited 2011-11-15 16:38
    I emailed RC Systems and received the following response:
    Two things I noticed right away in your code. First, if you are attempting to lock the V-Stamp’s baud rate, you should wait at least 75 ms OR wait for CTS to return to 0 after sending the FIRST character; see the “Note” regarding the baud rate measurement cycle on page 10 of the RC8660 User’s Manual. You only need to do this once after reset. Alternatively, you could program the V-Stamp for a fixed baud rate using the BRS pins, or with a Greeting Message (see Baud Rate description on page 32).

    Second, you need to terminate your message (“Garage Door Open”) with a CR or NUL. Otherwise, the message will just sit in the buffer until a CR/NUL comes along, which is why the message appears to be delayed until the next message is sent. Moving the CR from the front of your message string to the end should do the trick.

    As far as the echo you described, try changing the 01, “2R” command to 01, “0R”, or simply remove the command altogether (0R is already in place for the voice you set, “2O”). Also note that the “75F” setting is being overwritten by the following “45F” command in your initialization string.
    So RiJoRi, your suggestion of the Reverb may well have contributed to the issue..

    The significant fix was the second part. I had: [CR, "Garage Door Open"] I should have had: [00, "Garage Door Open", CR] I guess my text was hanging in the V-Stamp buffer, and was only spoken the next time a command was sent to it.
    I have all of the baud pins tied to High so that was not an issue. I also had some duplicate and redundant commands. I'm still not certain where and how often I need to place the initialization command, but I currently am placing it before each text string is sent. I'll have to play with that part.

    I did pour through the RC8860 Chipset User's Guide downloaded from the website and this module sure does have a lot of ways to adjust and customize for specific needs. Sending a simple text string is just scratching the surface. Tech support was quick with a reply and follow-up as well. I want to thank Xanatos for his excellent post on his Home Automation project. My simple project took on a whole new purpose when I was reading through that. My wife probably doesn't share my enthusiasm.

    graffix,
    Here are a couple pics of the V-Stamp. I'm using some Busboard Prototype System BB400 breadboards I found at Amazon. I was able to fit them together so they would accommodate the V-Stamp's unusual 1.2" pin row spacing (still .1").
    The second pic is of my current Home Monitoring system including a BS2px, Serial LCD, PINK, 1302 RTC, USB datalogger (to come), Rentron 433 MHz TX and TX, and serial connection to a remote BS2 that gathers sensor data and sends it to the Master for processing. The PINK holds a website that displays sensor status and various temps, water pressure, water flow, and allows me to operate lights via X-10. Most functions have been proofed individually and now I'm just getting it all to work together.

    CIMG0003.jpg
    CIMG0004.jpg


    falcon
    1024 x 768 - 109K
    1024 x 768 - 91K
  • RiJoRiRiJoRi Posts: 157
    edited 2011-11-16 08:42
    Falcon wrote: »
    ... So RiJoRi, your suggestion of the Reverb may well have contributed to the issue. ...
    falcon

    Glad I could help! Sometimes my WEGs are lucky and correct. Other times, well ...

    --Rich
Sign In or Register to comment.