Emic 2 help.
Hello, I am new to electronics and I am trying to learn on my own. I do fairly well with th basic stamp basics but need some help with Emic 2 board troubleshooting. I cannot get any output from the Emic2 board. I hooked it up as per the instructions (gnd, 5V, sin, sout, and 2 speaker leads) but get no output. The orange led lights during start up and then the green led stays lit. I am using the sample code from the Parallax Emic2 page for the basic stamp. The program executes but I never see the red led light, so I assume there is no communication between the stamp and Emic2. Below is the program I am using.
' {$STAMP BS2}
' {$PBASIC 2.5}
EmicBaud VAR Word
EMIC_TX PIN 0
EMIC_RX PIN 1
Init:
DEBUG CLS, "Emic 2 Text-to-Speech Module Demonstration", CR, CR
EmicBaud = 16468
SEROUT EMIC_TX, EmicBaud, [CR]
SERIN EMIC_RX, EmicBaud, 5000, No_Response, [WAIT(":")]: DEBUG "Ready!", CR '
Main:
DEBUG "Speaking some text..."
SEROUT EMIC_TX, EmicBaud, ["S", "Hello. My name is the Emic 2 Text-to-Speech module. I would like to sing you a song.", CR]
SERIN EMIC_RX, EmicBaud, [WAIT(":")]
PAUSE 500
SEROUT EMIC_TX, EmicBaud, ["D1", CR]
SERIN EMIC_RX, EmicBaud, [WAIT(":")]
DEBUG CR, "Demonstration complete!"
END
'
[ Subroutines ]
No_Response:
DEBUG "Ending demonstration!"
END
I run the program and I get the message:" Emic 2 Text-to-Speech Module Demonstration", followed by a pause(5000), then the message "Ending demonstration!"
I am using p0 and p1 on the basic stamp. I have reversed these just in case I had them in the wrong place, but the result is still the same. I am not sure what I am doing wrong?
Any help would be greatly appriciated.
Thank You.
' {$STAMP BS2}
' {$PBASIC 2.5}
EmicBaud VAR Word
EMIC_TX PIN 0
EMIC_RX PIN 1
Init:
DEBUG CLS, "Emic 2 Text-to-Speech Module Demonstration", CR, CR
EmicBaud = 16468
SEROUT EMIC_TX, EmicBaud, [CR]
SERIN EMIC_RX, EmicBaud, 5000, No_Response, [WAIT(":")]: DEBUG "Ready!", CR '
Main:
DEBUG "Speaking some text..."
SEROUT EMIC_TX, EmicBaud, ["S", "Hello. My name is the Emic 2 Text-to-Speech module. I would like to sing you a song.", CR]
SERIN EMIC_RX, EmicBaud, [WAIT(":")]
PAUSE 500
SEROUT EMIC_TX, EmicBaud, ["D1", CR]
SERIN EMIC_RX, EmicBaud, [WAIT(":")]
DEBUG CR, "Demonstration complete!"
END
'
[ Subroutines ]
No_Response:
DEBUG "Ending demonstration!"
END
I run the program and I get the message:" Emic 2 Text-to-Speech Module Demonstration", followed by a pause(5000), then the message "Ending demonstration!"
I am using p0 and p1 on the basic stamp. I have reversed these just in case I had them in the wrong place, but the result is still the same. I am not sure what I am doing wrong?
Any help would be greatly appriciated.
Thank You.
Comments
Just curious, are you sure your Emic board works? Have you ever heard it speak?
Red & green LEDs are both on initially for 2 seconds, then red only while speaking, then green only after speech ends.
' ========================================================================= ' ' File....... Emic2_Demo.bs2 ' Purpose.... Demonstration of the Emic 2 Text-to-Speech Module ' Author..... Joe Grand, Grand Idea Studio, Inc. [www.grandideastudio.com] ' E-mail..... support@parallax.com ' Updated.... 14 FEB 2012 ' ' {$STAMP BS2} ' {$PBASIC 2.5} ' ' ========================================================================= ' -----[ Program Description ]--------------------------------------------- ' ' This program provides a simple demonstration of the Emic 2 Text-to-Speech ' Module. Please refer to the product manual for full details of system ' functionality and capabilities. ' ' -----[ Revision History ]------------------------------------------------ ' ' 1.0: Initial release ' ' -----[ I/O Definitions ]------------------------------------------------- EMIC_TX PIN 13' Serial output (connects to Emic 2 SIN) EMIC_RX PIN 14 ' Serial input (connects to Emic 2 SOUT) ' -----[ Constants ]------------------------------------------------------- #SELECT $STAMP #CASE BS2, BS2E, BS2PE T9600 CON 84 #CASE BS2SX, BS2P T9600 CON 240 #ENDSELECT EmicBaud CON T9600 ' -----[ Initialization ]-------------------------------------------------- Init: DEBUG CLS, "Emic 2 Text-to-Speech Module Demonstration", CR, CR ' when the Emic 2 powers on, it takes about 3 seconds for it to successfully ' intialize. it then sends a ":" character to indicate it's ready to accept ' commands. if the Emic 2 is already initialized, a CR will also cause it ' to send a ":" DEBUG "Waiting for Emic 2..." SEROUT EMIC_TX, EmicBaud, [CR] SERIN EMIC_RX, EmicBaud, 5000, No_Response, [WAIT(":")] DEBUG "Ready!", CR ' -----[ Program Code ]---------------------------------------------------- Main: DEBUG "Speaking some text..." SEROUT EMIC_TX, EmicBaud, ["S", "Hello. My name is the Emic 2 Text-to-Speech module. I would like to sing you a song.", CR] ' Send the desired string to convert to speech SERIN EMIC_RX, EmicBaud, [WAIT(":")] ' Wait here until the Emic 2 responds with a ":" indicating it's ready to accept the next command DEBUG "Done!", CR PAUSE 500 ' Short delay DEBUG "Singing a song..." SEROUT EMIC_TX, EmicBaud, ["D1", CR] ' Play the built-in demonstration song. See the product manual for exact settings used to create this song. SERIN EMIC_RX, EmicBaud, [WAIT(":")] ' Wait here until the Emic 2 responds with a ":" indicating it's ready to accept the next command DEBUG "Done!", CR DEBUG CR, "Demonstration complete!" END ' -----[ Subroutines ]----------------------------------------------------- No_Response: ' if we get here, it means we did not receive a ":" from the Emic 2 DEBUG "No response!", CR, CR, "Ending demonstration!" END ' -----[ End of File ]----------------------------------------------------
EmicBaud = 16468
The correct value is 84.
Sorry it took so long to reply, I had to give it up for the night. I used your code and it works great. I agree that the parallax sample code was confusing to decode as printed in the sample. I came up with the number 16468 by an online formula: (1000000/9600)-20, covert to binary, add 1 or 0 to the 13th, 14th,and 15th places, then convert back to a number. I found this formula in multiple places so I assumed it was correct. I really really appriciate your help on this because it was getting very frustrating.
Thanks Again,
Babo18
https://www.youtube.com/watch?v=inM04mo9D8Q and
Both chips are a lot of fun to play with. As soon as you get speech down, all sorts of new project ideas will pop into your head. Here's one of my faves: