Emic2 speaks the commands instead of executing the commands ???
wperko
Posts: 66
Using this Wait4Emic2: do/loop I decided to insert a sertxd line at each subroutine after the Emic2 command subroutine has been sent ... What's with the Emic2? It works great on two other chip types (BS2 and PICAXE 28X2)
Wait4Emic2:
do
hserin Emic2Ready
loop until Emic2Ready = 58
sertxd ("58 from the Emic2 and exited the doloop",cr,lf)
return
Here's what happened ... the responses from the Emic2 seem exactly correct, but the Emic2 is not performing the commands correctly so it reads the commands instead of executing the commands ... but it does see the "S" for speak in front of the text it should read and reads the text. The Emic2 didn't play Song1 either, it just skips over that to the next text string ???
Kit Command ; First command is sent before the Wait4Emic2: do/loop
58 from the Emic2 and exited the doloop
Slowest Command ; Working correctly here ...
58 from the Emic2 and exited the doloop
Speak1 Command ; Working correctly here ...
58 from the Emic2 and exited the doloop
Song1 Command ; Working correctly here ...
58 from the Emic2 and exited the doloop
Fast Command ; Working correctly here ...
58 from the Emic2 and exited the doloop
Harry Command ; Working correctly here ...
58 from the Emic2 and exited the doloop
Speak2 Command ; Working correctly here ...
58 from the Emic2 and exited the doloop
Kit Command ; Working correctly here ...
58 from the Emic2 and exited the doloop
Slowest Command ; Working correctly here ...
58 from the Emic2 and exited the doloop
Speak1 Command ; Working correctly here ...
58 from the Emic2 and exited the doloop
Song1 Command ; Working correctly here ...
#picaxe 18M2 ; Define the µProcessor IC Type
#terminal 4800 ; Debug messages back to the PC
hsersetup B9600_4, %00
symbol Emic2Ready = b0
; BEGIN Main Body * * * * * * * * * * * * * * * * * * * * *
pause 3000
do
gosub Kit
gosub Slowest
gosub Speak1 ; Message 1
gosub Song1 ; Daisy
gosub Fast
gosub Harry
gosub Speak2 ; Message 2
loop
end
; END Main Body * * * * * * * * * * * * * * * * * * * * *
; Subroutines * * * * * * * * * * * * * * * * * * * * *
Speak1:
hserout 0, ("S", "This is Message 1 speaking very slow",cr)
sertxd ("Speak1 Command",cr,lf) ; Debug messages back to the PC
gosub Wait4Emic2
return
Speech0:
hserout 0, ("D0",cr)
sertxd ("Speech0 Command",cr,lf) ; Debug messages back to the PC
gosub Wait4Emic2
return
Song1:
hserout 0, ("D1",cr)
sertxd ("Song1 Command",cr,lf) ; Debug messages back to the PC
gosub Wait4Emic2
return
Speak1:
hserout 0, ("S", "This is Message 2 speaking Fast",cr) ; Debug messages back to the PC
sertxd ("Speak2 Command",cr,lf) ; Debug messages back to the PC
gosub Wait4Emic2
return
Kit:
hserout 0,("N5",cr) ; Uppity Ursula Voice
sertxd ("Kit Command",cr,lf) ; Debug messages back to the PC
gosub Wait4Emic2
return
Slowest:
hserout 0,("W75",cr) ; Slowest Speech
sertxd ("Slowest Command",cr,lf) ; Debug messages back to the PC
gosub Wait4Emic2
return
Fast:
hserout 0,("W250",cr) ; Fast Speech
sertxd ("Fast Command",cr,lf) ; Debug messages back to the PC
gosub Wait4Emic2
return
Harry:
hserout 0,("N1",cr) ; Uppity Ursula Voice
sertxd ("Harry Command",cr,lf) ; Debug messages back to the PC
gosub Wait4Emic2
return
end
; END Subroutines * * * * * * * * * * * * * * * * * * * * *
Wait4Emic2:
do
hserin Emic2Ready
loop until Emic2Ready = 58
sertxd ("58 from the Emic2 and exited the doloop",cr,lf)
return
Here's what happened ... the responses from the Emic2 seem exactly correct, but the Emic2 is not performing the commands correctly so it reads the commands instead of executing the commands ... but it does see the "S" for speak in front of the text it should read and reads the text. The Emic2 didn't play Song1 either, it just skips over that to the next text string ???
Kit Command ; First command is sent before the Wait4Emic2: do/loop
58 from the Emic2 and exited the doloop
Slowest Command ; Working correctly here ...
58 from the Emic2 and exited the doloop
Speak1 Command ; Working correctly here ...
58 from the Emic2 and exited the doloop
Song1 Command ; Working correctly here ...
58 from the Emic2 and exited the doloop
Fast Command ; Working correctly here ...
58 from the Emic2 and exited the doloop
Harry Command ; Working correctly here ...
58 from the Emic2 and exited the doloop
Speak2 Command ; Working correctly here ...
58 from the Emic2 and exited the doloop
Kit Command ; Working correctly here ...
58 from the Emic2 and exited the doloop
Slowest Command ; Working correctly here ...
58 from the Emic2 and exited the doloop
Speak1 Command ; Working correctly here ...
58 from the Emic2 and exited the doloop
Song1 Command ; Working correctly here ...
#picaxe 18M2 ; Define the µProcessor IC Type
#terminal 4800 ; Debug messages back to the PC
hsersetup B9600_4, %00
symbol Emic2Ready = b0
; BEGIN Main Body * * * * * * * * * * * * * * * * * * * * *
pause 3000
do
gosub Kit
gosub Slowest
gosub Speak1 ; Message 1
gosub Song1 ; Daisy
gosub Fast
gosub Harry
gosub Speak2 ; Message 2
loop
end
; END Main Body * * * * * * * * * * * * * * * * * * * * *
; Subroutines * * * * * * * * * * * * * * * * * * * * *
Speak1:
hserout 0, ("S", "This is Message 1 speaking very slow",cr)
sertxd ("Speak1 Command",cr,lf) ; Debug messages back to the PC
gosub Wait4Emic2
return
Speech0:
hserout 0, ("D0",cr)
sertxd ("Speech0 Command",cr,lf) ; Debug messages back to the PC
gosub Wait4Emic2
return
Song1:
hserout 0, ("D1",cr)
sertxd ("Song1 Command",cr,lf) ; Debug messages back to the PC
gosub Wait4Emic2
return
Speak1:
hserout 0, ("S", "This is Message 2 speaking Fast",cr) ; Debug messages back to the PC
sertxd ("Speak2 Command",cr,lf) ; Debug messages back to the PC
gosub Wait4Emic2
return
Kit:
hserout 0,("N5",cr) ; Uppity Ursula Voice
sertxd ("Kit Command",cr,lf) ; Debug messages back to the PC
gosub Wait4Emic2
return
Slowest:
hserout 0,("W75",cr) ; Slowest Speech
sertxd ("Slowest Command",cr,lf) ; Debug messages back to the PC
gosub Wait4Emic2
return
Fast:
hserout 0,("W250",cr) ; Fast Speech
sertxd ("Fast Command",cr,lf) ; Debug messages back to the PC
gosub Wait4Emic2
return
Harry:
hserout 0,("N1",cr) ; Uppity Ursula Voice
sertxd ("Harry Command",cr,lf) ; Debug messages back to the PC
gosub Wait4Emic2
return
end
; END Subroutines * * * * * * * * * * * * * * * * * * * * *
Comments
Having to tweak code to work on the various PicAxe chips can be frustrating...
Part of the problem is the Emic2 manual say's it sends either a ":" or a "?" as a response to input, but I'm also receiving "cr" characters ... I'm trying to find out what the Emic2 actually sends out ...