I'm running PE6 on a 20x2 with an Emic2 TTS Module. I believe that I'm having a "turn around timing" problem with this code. Things work OK when the Emic2 module sends it's response after the "speaking" message sent with the Sxxx command. This takes over 1 second and everything works OK. However, when I send the Lx command (which responds in about 0.2 Mseconds), the responses are "garbled' and there doesn't seem to be a pattern to the responses. Seems to me that part of the response from Emic2 has been sent before the 20x2 serin is ready to receive. Any comments about what may be happening? Jims
Code:
[color=Green]'* 20x2 running Emic 2 text to speech module.
'* Transmit message to Emic2 with "serout",
'* use "serin" to wait for response, then
'* display the response on serial terminal.[/color]
[color=Blue]symbol [/color][color=Black]xmit_out[/color][color=DarkCyan]=[/color][color=Blue]C.0 [/color][color=Green]'pin 10 green wire[/color]
[color=Blue]symbol [/color][color=Black]rcv_in[/color][color=DarkCyan]=[/color][color=Blue]B.6 [/color][color=Green]'pin 12 white wire[/color]
[color=Navy]#Picaxe [/color][color=Black]20x2[/color]
[color=Navy]#Terminal 9600[/color]
[color=Green]' Use these values when simulating with serin ( 13 58 ) raw.[/color]
[color=Black]init:[/color]
[color=Blue]pause [/color][color=Navy]3000 [/color][color=Green]'Module takes 3 seconds to initialize on power-up.[/color]
[color=Blue]high C.0 [/color][color=Green]'Put xmit line into true state.
'serout xmit_out,T9600 ,("V16",cr) 'Set volume loud, 16 decibles.[/color]
[color=Blue]pause [/color][color=Navy]50
[/color]
[color=Black]main:
[/color][color=Blue]do
[/color][color=Purple]b0[/color][color=DarkCyan]=[/color][color=Navy]0[/color][color=Black]:[/color][color=Purple]b1[/color][color=DarkCyan]=[/color][color=Navy]0
[/color][color=Blue]pause [/color][color=Navy]100
[/color][color=Green]'serout xmit_out,T9600 , ("S"," I got your message. ",cr) 'Speak message.
[/color][color=Blue]serout [/color][color=Black]xmit_out,[/color][color=Blue]T9600[/color][color=Black],[/color][color=Blue]([/color][color=Red]"L0"[/color][color=Black],[/color][color=Blue]cr) [/color][color=Green]'Set language to English.
[/color][color=Blue]SerIn [/color][color=Black]rcv_in, [/color][color=Blue]T9600 [/color][color=Black], [/color][color=Purple]b0[/color][color=Black],[/color][color=Purple]b1 [/color][color=Green]'wait for response
[/color][color=Blue]sertxd ([/color][color=Red]"Received "[/color][color=Black],#[/color][color=Purple]b0[/color][color=Black],[/color][color=Red]" "[/color][color=Black],#[/color][color=Purple]b1[/color][color=Black],[/color][color=Navy]13[/color][color=Black],[/color][color=Navy]10[/color][color=Blue])[/color][color=Green]'Display the 2 data bytes received.
[/color][color=Blue]pause [/color][color=Navy]3000
[/color][color=Blue]loop[/color]