What version of the IDE are you using? I tested the baud rates upto 230400bps on 8.0.1.3.
Also remember BAP inverted is the same as Stamp non-inverted(eg we are reveresed from them). Also the baudmode value has no resemblence to the Stamp number. We use different bits all together to indicate the bitrate and the othere states(inverted,parity,open or driven etc…). Thats why we have the constants(i9600 for inverted 8n1 and n9600 for non-inverted 8n1). The “i” modes are for use with things like PCs with max232 circuits. The “n” modes are for direct connections to other devices/chips without an inverter circuit.
Scroll down to the bottom for the link to the SpeakJet manual
Here’s the code I’m using. It has been converted to work with the BAP: (This code has been tested on the Basic Stamp II)
[code]PA0 CON 0 ’ pauses
PA1 CON 1
PA2 CON 2
PA3 CON 3
PA4 CON 4
PA5 CON 5
PA6 CON 6
Fast CON 7
Slow CON 8
Stress CON 14
Relax CON 15
_Wait CON 16 ’ note underscore
Soft CON 18
Volume CON 20
Speed CON 21
Pitch CON 22
Bend CON 23
PortCtr CON 24
Port CON 25
Repeat CON 26
CallPhr CON 28
GotoPhr CON 29
Delay CON 30
Reset CON 31
IY CON 128
IH CON 129
EY CON 130
EH_ CON 131
AY CON 132
AX CON 133
UX CON 134
OH CON 135
AW CON 136
OW CON 137
UH CON 138
UW CON 139
MM CON 140
NE CON 141
NO CON 142
NGE CON 143
NGO CON 144
LE CON 145
LO CON 146
WW CON 147
RR CON 148
IYRR CON 149
EYRR CON 150
AXRR CON 151
AWRR CON 152
OWRR CON 153
EYIY CON 154
OHIY CON 155
OWIY CON 156
OHIH CON 157
IYEH CON 158
EHLL CON 159
IYUW CON 160
AXUW CON 161
IHWW CON 162
AYWW CON 163
OWWW CON 164
JH CON 165
VV CON 166
ZZ CON 167
ZH CON 168
DH_ CON 169
BE CON 170
BO CON 171
EB CON 172
OB CON 173
DE CON 174 DO CON 175 ’ note underscore
ED CON 176
OD CON 177
GE CON 178
GO CON 179
EG CON 180
OG CON 181
CH CON 182
HE CON 183
HO CON 184
WH CON 185
FF CON 186
SE CON 187
SO CON 188
SH CON 189
TH CON 190
TT CON 191
TU CON 192
TS CON 193
KE CON 194
KO CON 195
EK CON 196
OK CON 197
PE CON 198
PO CON 199
RO CON 200
R1 CON 201
R2 CON 202
R3 CON 203
R4 CON 204
R5 CON 205
R6 CON 206
R7 CON 207
R8 CON 208
R9 CON 209
A0 CON 210
A1 CON 211
A2 CON 212
A3 CON 213
A4 CON 214
A5 CON 215
A6 CON 216
A7 CON 217
A8 CON 218
A9 CON 219
_B0 CON 220 ’ note underscore
_B1 CON 221
_B2 CON 222
_B3 CON 223
_B4 CON 224
_B5 CON 225
_B6 CON 226
_B7 CON 227
_B8 CON 228
_B9 CON 229
C0 CON 230
C1 CON 231
C2 CON 232
C3 CON 233
C4 CON 234
C5 CON 235
C6 CON 236
C7 CON 237
C8 CON 238
C9 CON 239
D0 CON 240 ’ DTMF tones
D1 CON 241
D2 CON 242
D3 CON 243
D4 CON 244
D5 CON 245
D6 CON 246
D7 CON 247
D8 CON 248
D9 CON 249
D10 CON 250
D11 CON 251
M0 CON 252 ’ sonar pin
M1 CON 253 ’ pistol shot
M2 CON 254 ’ WOW
EOS CON 255
TX CON P2
RDY CON P0
;My name is Vecter
SEROUT TX \ RDY,N9600,[262] ;Sound BEEP
Ok so decsribe what happens. Does the beep sound? If so do any of the other commands run? Have you tried changing the code to not use flow control(eg send a couple commands you know won’t over flow the buffer) to see if you can get it working at all first. From the manual I do beleive n9600 is the correct baudmode but it is a little confusing. If you can connect the speakjet to a PC serial port through a max232 then you should be using i9600. Also note that the BAP has almost no delay between bytes being sent compared to a BS2. I see nothing in the datasheet saying the speakjet needs any delay between characters(there is no electrical characteristics in the datasheet) but it may so you should try adding a delay between each byte sent(eg see the pace argument for serout).
I have tried sending shorter data to the SJ to see if it would work without overflowing the buffer and it did not work. I also tried sending preset commands to cause the SJ to sound stored sounds, for example a beep.
When the BAP sends data to the SJ, in this case the number 262, it should generate a beep, instead it generates a distorted sound.
In an older version, I was able to get the BAP to send commands and it generated speech and sounds without any problems except flow controll. For the flow control problem, I used the delay feature that forced the BAP to pause X amount of time before moving to the next serout command. This worked fine but now it does not seem to work at all any more.
It might be possible there is something wrong with the BAP however, it moves a servo fine.
EDIT
I just rehooked everything to the BS2 and it works without any problems. I have no idea wht it works with one and not the other?
Not sure if I could add anything here, but have you tried different pins? Also I am assuming that the speakerjet gets its power from the connections from the BAP. So I am assuming you have the jumpers set properly and the TX line is on P2 and the RDY line is on P0…
Have you tried pausing before you do the output? I know when I try to use an LCD’s, I need to give them some time to initialize before I output to them.
It would be interesting to see the serial output of the simple beep on an oscilloscope for both the BAP and the BS2 to see the differences. If I get a chance, I might try hooking up my very limited Parallax USB scope and see what I see. Recently I was not able to make my LCD work reliably at 9600 baud on my BRAT, but that was with HSERVO enabled as well as some other interrupt code running. If I have some more time, I might dig through my box of stuff and pull out the BS2 and try to scope the same and compare the two. But right now I should get back to working on the revisions to our house plans…
I have tried all pins available on the bot board with no luck. I thought about checking the outputs on an 'O Scope also, but I don’t have one.
There is one thing I need to try: If I remember correctly, When I had it working before without the flow control fix, I used a seperate power supply for the speak jet board. The Bot board used 9v and the SJ used a seperate 9v supply and it worked. Perhaps using a shared power supply is my problem. I will post my results later today.
EDIT
I tried using a seperate power supply and it did not help any. I’m all out of ideas.
I have an output on my Parallax USB Oscilloscope, I put a high and a low on a different pin so I could frame in where the signal is. I would post a picture but I don’t feel like finding a place to post it. My first question is are you really wanting to send two bytes here for the beep?
The [262] is actually two bytes. In hex: 01, 06
Let me know if that is correct before I try doing the same on BAP.
The Low and the high commands are not needed for the serout, but I used them as another pin to show on the oscilloscope. The red trace shows this on the bitmaps while the blue trace shows the output of the serout command. I sent email to you and Nathan. Notice the differences in the traces and timing between the BAP and BS2…
You are welcome. I just sent you and Nathan an image that used photoshop to overlay the i9600 wave of the BAP with the output of $54 on the BS2. The waves look identical.
So if the sending on the 262 does not work the same on the BAP as the BS2 when you use i9600(BAP) or $54(BS2) then I am not sure what is happening.
Have you tried using the seperate power supply you mentioned earlier?
Yes, the seperate power supply did not work. After the results you posted, I am thinking the BAP is possibly dammaged.
There was a time when the BAP worked well with the SJ board but this was before flow control was fixed in the latest IDE release. I must have dammaged the BAP somewhere before the last two IDE releases. The next option is to try another BAP to rule out a faulty BAP.
The next thing I would do is to re-install the 8.0.1.0 release and see if by chance you can get it to work. Nathan saw something in my traces I sent to both of you that he wants me to check out. My scope set up is rather limited as the trace buffer is so small. But it has helped me to localize and issolate a few issues.
We will see if it makes sense for you to ship it out to me or not. Hopefully we can find out the problem before it comes to that.
Good Luck.
**Edit -**Looking over your previous posts I see you got it to work earlier with N9600. So if I get time later today or tomorrow, I will try to see the differences (if any) between the output of the one character on the current beta 8.0.1.3 and the earlier version…
What I saw in the trace(and confirmed by a second trace) was that the non-inverted serial mode is not outpuing ANY pulses. It remains high the whole time. I’m going to fix it this weekend.
main
serout p0,i9600,[0xa5]
serout p1,n9600,[0xa5]
pause 10
goto main
I checked this on a scope. The n9600 was an exact mirror of the i9600 signal. Kurt I think there may be a problem with your osilloscope. Maybe it’s not triggering correctly on the non-inverted data. Can you try the above test code and get back to me?