control-P as ascii text?
Humanoido
Posts: 5,770
Using a BS2 and serout, how do you send a control-P as ascii text?
I'm stuck at this point, using an Emic TTS board, trying to activate the phonetic alphabet, by sending a control-P. I know how to send it as hex and this is working in hex mode. But I don't know how to send it as text using text mode. When I type a control-P from the Editor, it goes into print mode. Is there something very simple that I'm overlooking?
I'm stuck at this point, using an Emic TTS board, trying to activate the phonetic alphabet, by sending a control-P. I know how to send it as hex and this is working in hex mode. But I don't know how to send it as text using text mode. When I type a control-P from the Editor, it goes into print mode. Is there something very simple that I'm overlooking?
Comments
programatically simulating keystrokes I would send "^P", no guarantee but you could try it.
Jeff T.
Typing the Ctrl+P goes into print mode.
P42 • BASIC Stamp Syntax and Reference Manual
Ctrl+P = Print current source code
www.parallax.com/Portals/0/Downloads/docs/prod/stamps/web-BSM-v2.2.pdf
Maybe it's impossible? Any more guru's care to take a look at it?
Post Edited (humanoido) : 10/15/2008 4:10:29 PM GMT
-Phil
I'm beginning to think this is a bug in the Emic.
It it's still a problem, it would help if you posted some code...
-Phil
SEROUT 1, 84, [noparse][[/noparse]$00,"welcome to mount ",$10,"t@m@lp1YIs",$AA]
where the commands are $00 for "say", $10 for "next word phonetic", and $AA is "end of message".
It works fine, although the phonetic pronunciation of the word is still not quite "native".
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Here's the main code that speaks the first sentence, but does not active the phonetic alphabet after that - the suggestions were tried and also stuff in green did not work.
' {$STAMP BS2}
' {$PBASIC 2.5}
#SELECT $STAMP
#CASE BS2, BS2E, BS2PE
Baud CON 396 ' 2400 baud, N81
#CASE BS2SX, BS2P
Baud CON 1021
#ENDSELECT
Tx PIN 0 ' connects to Emic SIn
Rx PIN 1 ' connects to Emic SOut
Reset PIN 3 ' 1 = normal op, 0 = hard reset
DLE CON 16
x CON $10
SEROUT Tx, Baud, [noparse][[/noparse]"say= The quick;"] ' speaking routines
SERIN Rx, Baud, [noparse][[/noparse]WAIT ("OK")] ' wait for ok from emic then proceed
'SEROUT Tx, Baud, x ' control P
'SEROUT Tx, Baud, [noparse][[/noparse]"say= ^Pbw1Wn fox. ;"]
'SEROUT Tx, Baud, [noparse][[/noparse]16,"say= ^Pbw1Wn fox. ;"]
'SEROUT Tx, Baud, [noparse][[/noparse]x,"say= bw1Wn fox. ;"]
'SEROUT Tx, Baud, [noparse][[/noparse]"say= 16 w1Wn fox. ;"]
'SEROUT Tx, Baud, [noparse][[/noparse]"say= 16w1Wn fox. ;"]
'SEROUT Tx, Baud, [noparse][[/noparse]DEC1 16, "say= ^Pbw1Wn fox. ;"]
'SEROUT Tx, Baud, [noparse][[/noparse]"The quick ", DLE, "bw1Wn fox."]
SERIN Rx, Baud, [noparse][[/noparse]WAIT ("OK")] ' wait for ok from emic then proceed
STOP ' maintain processor state
SEROUT Tx, Baud, [noparse][[/noparse]"say=The quick ",$10,"bw1Wn fox. ;"]
The ^P has to immediately precede the phonetically spelled word, and the phonetics end with the space that follows the word.
Why don't you use HEX mode?
Re: control of the EMIC from the PC keybaord. If you want to send ^P (ascii 16=$10) from the STAMPW IDE debug screen, type SHIFT-CTRL-P. CTRL-P alone as you know brings up the PC print dialog, but add the SHIFT and the IDE will send the control character instead.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Why ASCII and not HEX Mode? The Emic commands were already defined English, in ASCII mode, and did not need to be redefined with code statements with constants. For small programs, total code lines could be few, even with some sacrifice in memory usage. HEX can sometimes be less intuitive. The text line syntax appears easier to work with. I like to have Emic return "OK" when it's ready, which is more explicable than a hex number. I wanted to write everything in ASCII and compare it to HEX. I have other application code which uses ASCII and want to combine this code with it, and have all code use the same standard ASCII for serial communications. I already had sample code for the Emic that used HEX and wanted to write the routines in ASCII mode.