Serrxd and data from PC


Senior Member
Hello all.
I'm trying to push some data (3 values per record) from a file on the PC to the 40X2. I noticed that the data received on the picaxe was not what I was sending. I am using a simple (liberty basic) app and the text file containing the lines with the data. I wrote a small program to receive 3 word variables (serrxd) and then send back (sertxd) those values. Using a logic probe I was able to watch both serial directions and also the data.

This is the code I am using to test the data transfer:
for b0 = 1 to 20
    serrxd #w10, #w11, #w12
    sertxd (#w10, ",", #w11, ",", #w12, 10, 13)
next b0
This is how I send every data line to the picaxe: '1st value' + 'space' + '2nd value' + 'space' + '3rd value' + 'space'
I was expecting to see a response from the picaxe for every data line sent (3 values), but this is how it looks on my logic probe:


It seems I'm getting a response every 3 data lines, which of course messes up the data.
Data is sent at 9600 with 500ms delay between data lines.

Any ideas or tips for troubleshooting?


Senior Member
Not quite sure why it's not working because it does for me when I test with a 28X2.

I had thought it might be that using 'space' as the separator might be the cause of the problem but that works for me.

Are you sure the pulses on the bottom trace are one per line and not one per data item ?

Are you sure Liberty Basic is sending what you think it is sending, is using the correct baud rate and polarity ?

The only other thing I can think is that there's a baud rate or over-tun issue so the later data is corrupted so, "11 22 33 " is received as "1xxxxxxxx", which takes three transmissions to satisfy the SERIN.

If you send "11 22 33 " what does the SERXTD report ? If "1,1,1" or "11,11,11", it would seem it's only taking the start of each line sent. Perhaps try sending the data in sequential print statements, sequential print statements for each character sent.

Your "SERTXD( ..., 10, 13 )" is LF then CR so that might be confusing things. Try ",CR,LF)"


Senior Member
Hi Hippy.

Yes, the pulses are per line and not per data item. This is the record line containing "557 3 0" as data:


I run all your 3 suggestions in two ways and captured the flows. In the first way, I used the Serial Terminal and pasted each line by hand. I removed the option to have CR+LF added to the end automatically and I just added an extra space character to have the serrxd identify the end of the digits. It worked for all 3 cases. Here is a screenshot of the pulses then sending "11 22 33 ":


As you can see there is quite a gap in between each character send from the Serial Terminal. Here is a screenshot from the LibertyBasic app sending the same groups of numbers:


Of course, it didn't work. You can also see that the characters I received from Picaxe (PicAxe TX) are missing a few pulses on the second group. I finally tried using a ~5ms delay between each character, this is the delay I measured when capturing data from the Serial Terminal, and it worked fine this time:


Finally, I run a set of 20 records using a pause in between the characters and I managed to get a reply on every record with correct data this time:

It seems you need to make sure that you allow PicAxe some time in order to translate characters into a number before sending in another character. This is the first time I stumble on something like that, since most of my comms are talking place using 2400bps. I guess at that speed PicAxe has a bit more time to translate between characters and numbers. Still, I need to go through a 'full blown' data transfer, but I don't think I will have an issue any more. I will update this thread if I do find an issue.

Hippy, thank you for your help and suggestions.