Using serrxd Under Linux Based Control

eDev

New Member
Greetings:

I'm working on a project to send commands to a PICAXE 18M2 MCU's serial I/O pin (serrxd) via a Linux based RS232 serial port. While redundant, the programming function is turned off using the 'disconnect' command earlier in the program.

I'm able to receive data just fine, but haven't had any luck transmitting to the 18M2 from software control be it a perl or C based program.

FYI: This is running at 4800 8N1.

The PICAXE 18M2 code looks like this:

serrxd [80],("iss"),D0,D1,D2,D3,D4,D5,D6,D7

The general format of what I'm sending (from a C perspective) looks like this:

string[] = "issABCDEFGH"; // preamble + 8 data bytes

It's interesting to note that sending the above string (i.e. issABCDEFGH) works just fine using the PICAXE programming Terminal program under Windows.

All this leads to my questions:

1) What, exactly, is the data transfer format of the serial stream when sent from the Programming Editor's Terminal (F8) program?
2) What, if any, termination character is expected by the the serrxd command?
3) Is there any delay or special handling needed because of the preamble strings (i.e. "iss")?

Thanks for your help and time!
 

hippy

Technical Support
Staff member
Welcome to the PICAXE forum.

That it works with the Programming Editor Terminal but not from within a program suggests the program is sending the data bytes back to back with no gaps between bytes, not leaving the PICAXE enough time to process a byte and be ready for the next. By default the Terminal will add delays between each byte sent where a Windows/Linux program usually will not.

Check serial is working by only sending a single byte every so often from within your program and use a SERIN without a timeout and without qualifiers to read that byte.
 

eDev

New Member
Hippy:

Yep, that fixed it! I put a gcc "usleep(100)" line after each byte is send and the target device worked as expected.

Seriously, you ROCK - I really appreciate your help!

Thanks!

eDev
 
Top