V-Stamp repeats old phrase after changing text
Falcon
Posts: 191
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:
Anyone entounter this? Or have any advise?
falcon
' {$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 ENDThe 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
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
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
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
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.
falcon
Glad I could help! Sometimes my WEGs are lucky and correct. Other times, well ...
--Rich