28X2 serout command set for 9600 8N1 ???

SolidWorksMagi

Senior Member
Hi,

I'm trying to send data through 28X2 pins to another device that requires 9600 BAUD 8N1 data/rate ... From the online manual this looks right, but doesn't work ...

#picaxe 28X2 ; Define the µProcessor IC Type
#terminal 9600

; BEGIN Main Body * * * * * * * * * * * * * * * * * * * * * * *
pause 3000

high A.0
serout A.0,T9600_8,("20, 96, 21, 114, 22, 82, 23, 5, 22, 87, 148, 135, 22, 82, 165, 148")

end
; END Main Body * * * * * * * * * * * * * * * * * * * * * * **

Why doesn't this work? I tried different settings for the "chip speed" but all I get is garbage on the other end ???
 

hippy

Senior Member
You probably need a HIGH A.0 at the start of the program to avoid corrupting the first character when a Txxxx baud rate is used. It might be you actually need a N9600 baud rate depending on what you are sending to or the hardware interface you have. You might also need a CR or LF or CR,LF terminator in the SERTXD.
 

SolidWorksMagi

Senior Member
Try sending the data without the quote marks.
Hi,

Yeah! That did the trick ... I hadn't tried eliminating the quotes because I thought they were a part of the BASIC syntax for the line ... but it works perfect soon as the quotes are removed!

Thanks ...
 

SolidWorksMagi

Senior Member
You probably need a HIGH A.0 at the start of the program to avoid corrupting the first character when a Txxxx baud rate is used. It might be you actually need a N9600 baud rate depending on what you are sending to or the hardware interface you have. You might also need a CR or LF or CR,LF terminator in the SERTXD.

Hi,

I’ve used the board on a few projects. I’m pretty sure it works. I setup two different PINs for Serial output 9600 8N1;

I just did a test with another RoboGuts™ circuit board and PICAXE 28X2 to send serial data from hserout PIN 11 and looked at the scope signal to hear the SpeakJet chip talk;

24528



Then I did another test with the same RoboGuts™ circuit board and PICAXE 28X2 to send serial data from serout PIN 7 and looked at the scope signal to NOT hear the SpeakJet chip talk;

24529



I don’t know how to setup a trigger to capture the start of the serial data and capture a full image of the serial data bits. This is where I wish I had a PC scope that can capture data as a video.

I don’t understand why the serout isn’t just regular serial 9600 8N1 data. The manual seems to say it is.

I has also tried sending the serial data via the actual sertxd PIN 1 on the PICAXE 28X2 module, but the Maestro 6 comes up with an error when I do that, yet that is also normal 9600 8N1 data!

sertxd (20, 96, 21, 114, 22, 88, 23, 5, 22, 100, 166, 137, 194, 135, 145, 191, 131, 8, 187, 191, 2, 2, 8, 187, 131, 195, 133, 141, 177, 2, 22, 95, 166, 137, 194, 135, 145, 22, 100, 191, 131, 8, 187, 191)

Terminal screen data;
[14]`[15]r[16]X[17][05][16]d[A6][89][C2][87][91][BF][83][08][BB][BF][02][02][08][BB][83][C3][85][8D][B1][02][16]_[A6][89][C2][87][91][16]d[BF][83][08][BB][BF]

I really don’t understand why that’s different either! It’s all supposed to be 9600 8N1 BAUD!
 

AllyCat

Senior Member
Hi,
I don’t know how to setup a trigger to capture the start of the serial data and capture a full image of the serial data bits.

sertxd (20, 96, 21, 114, 22, 88, 23, 5, 22, 100, 166, 137, 194, 135, 145, 191, 131, 8, 187, 191, 2, 2, 8, 187, 131, 195, 133, 141, 177, 2, 22, 95, 166, 137, 194, 135, 145, 22, 100, 191, 131, 8, 187, 191)
Terminal screen data;
[14]`[15]r[16]X[17][05][16]d[A6][89][C2][87][91][BF][83][08][BB][BF][02][02][08][BB][83][C3][85][8D][B1][02][16]_[A6][89][C2][87][91][16]d[BF][83][08][BB][BF]
You should be able to trigger the 'scope by changing the "AUTO" mode (at Top Left) to "Trig" or something similar.

I've not checked all the data but you are sending the SERTXD data byte in decimal (base 10) format, but the Terminal is using HEX (base 16) format, which is configurable: "Settings : Display all RX data as.....". For example A6 (or $A6 in PICaxe format) is the same as 166 in decimal. And at the beginning: 20 is $14 , 96 is the printable (ASCII code) ' , 21 is $15 , 114 printable r , etc...

Cheers, Alan.
 

Flenser

Senior Member
I don’t understand why the serout isn’t just regular serial 9600 8N1 data. The manual seems to say it is.
SolidWorksMagi,
I don't understand what you mean by this comment. Can you clarify?

The output from your serout A.0,T9600_8,(....) command _is_ serial 9600 8N1. The only thing that varies is whether logic "0" is 5V (the Txxx baudmodes) or logic "0" is 0V (the Nxxx baudmodes).
 

SolidWorksMagi

Senior Member
Hi,

What I'm doing is trying to send a set of commands to a serial port on a Maestro 6 servo controller with a PICAXE 28X2 module. The problem is by the time the data gets there nothing is happening.

IF I use the sertxd command and PIN 1 the Maestro 6 servo controller goes into error mode,

IF I use the serout command on PIN 7 C.2 the Maestro 6 servo controller just sits there like nothing is happening,

IF I use the hserout command on PIN 11 C.6, the Maestro 6 servo controller just sit there like nothing is happening.

So, I tried sending the strings of data to a synth chip for speech since I know that works with the hserout command and the synth chip is 9600 8N1 BAUD serial IN.

Yes, the hserout works with the synth chip perfectly, but not the Maestro 6 servo controller ???

Sadly, I've never gotten the sertxd and serout commands DO NOT WORK with the synth chip ???

Geeze, serial 9600 8N1 should be one set of signals and bits! ... a standard. IF it's not serial 9600 8N1, then it should say "Inverted" or something else.

BTW, if it's "inverted" data, then do I use the complementary number in the code? 132 = 10000100 so inverted port would use 01111011 = 123?
 

inglewoodpete

Senior Member
BTW, if it's "inverted" data, then do I use the complementary number in the code? 132 = 10000100 so inverted port would use 01111011 = 123?
No, just invert the serial port's polarity in the SerOut command, along with the idle state of the pin concerned. The PICAXE firmware behind the SerOut command will invert the data for you.

For "True" Data:
Code:
         Symbol oSerData   = <port.pin>                    'Define the serial output pin

         High oSerData                                     'Add this command to the chip's startup code

         SerOut oSerData, T9600_8, (bData1 bData2, bData3) 'Note: idles high - Use this command to send your data
For "iNverted" Data:
Code:
         Symbol oSerData   = <port.pin>                    'Define the serial output pin

         Low oSerData                                      'Add this command to the chip's startup code

         SerOut oSerData, N9600_8, (bData1 bData2, bData3) 'Note: idles low - Use this command to send your data
 
Last edited:

AllyCat

Senior Member
Hi,
IF it's not serial 9600 8N1, then it should say "Inverted" or something else.
That's what the "N" means (iNverted or "Not"). If it's not "Inverted" then it's called "T" for True or sometimes "TTL". And as IWP says, you can't (just) invert the data because the Start and Stop bits need to be inverted as well. But it's difficult to help when I've never used a "Maestro 6" (but I do see the secification says the serial interface is "TTL"), and even less a "SpeakJet chip talk".

Cheers, Alan.
 

Flenser

Senior Member
if it's "inverted" data, then do I use the complementary number in the code? 132 = 10000100 so inverted port would use 01111011 = 123?
No. If the serial is inverted then you use the one of the Nxxx baudmode parameters for SEROUT instead of one the the Txxx baudmodes.
You do not make any change to the data you send.
e.g.
- serout A.0,T9600_8,(97) sends the value 97 decimal (which is the character "a") using non-inverted serial
- serout A.0,T9600_8,("a") sends the character "a" using non-inverted serial
- serout A.0,N9600_8,(97) sends the value 97 decimal (which is the character "a") using inverted serial
- serout A.0,N9600_8,("a") sends the character "a" using inverted serial
 

SolidWorksMagi

Senior Member
No. If the serial is inverted then you use the one of the Nxxx baudmode parameters for SEROUT instead of one the the Txxx baudmodes.
You do not make any change to the data you send.
e.g.
- serout A.0,T9600_8,(97) sends the value 97 decimal (which is the character "a") using non-inverted serial
- serout A.0,T9600_8,("a") sends the character "a" using non-inverted serial
- serout A.0,N9600_8,(97) sends the value 97 decimal (which is the character "a") using inverted serial
- serout A.0,N9600_8,("a") sends the character "a" using inverted serial

Hi, Changing from N to T worked to send speech bits to the speech synth chip. Sadly, the other device (Pololu.com Maestro 6) still refuses to perform.

Thanks! I learned something new and very useful!


I've checked all the connections, battery power etc. a dozen times, I think the Maestro 6 might just not be working from TTL Serial data even though it does accept USB port data just fine.
 

AllyCat

Senior Member
Hi,

For the Serial UART mode, I see that the User Manual says:

The serial mode is “UART, detect baud rate”; after you send the 0xAA baud rate indication byte, the Maestro will accept TTL-level serial commands on the RX line.
The Pololu Protocol device number is 12, the Mini SSC offset is 0, and serial timeout and CRC are disabled.


So are you remembering to transmit the $AA or a 170 byte before you send any control bytes? It's not clear how often that needs to be sent, but it may well have become "confused" if you've been sending it incorrect data, such as N-polarity or another byte.

Cheers, Alan.
 
Top