Serial communications

I need an idea to solve a small problem. When I communicate with the picaxe using sertxd and serrxd, I can send data from the picaxe to the computer with sertxd and the computer will put the data in a buffer, so I can read them, when I have the time. The problem is, that there apparently isn’t such a buffer on the picaxe, so if I want to send data to the picaxe, I have to wait until the picaxe is at the serrxd command, before I send. One solution is to call serrxd with a small timeout frequently, but that is not an optimal solution, since it would take time when the robot is “doing other things”. One idea, that I am playing with, is to let the pc send the sequence repeatedly, let the picaxe return some kind of acknowledge signal when it has received the data sequence and stop the transmission from the PC when the ack is received. Any other ideas?

For general info: This is

For general info: This is why things like the Easy Radio has more pins; it is flags for "High when ready to take more data" etc.

- But I guess you are not interested in setting pins on the Picaxe, for the computer to read?

So in your situation I guess you are left with:

Let the PC wait for a byte from the Picaxe saying "I am ready"

or

Some "hard-coded protocol that you find works" - such as "If I then let this wait 20ms, and then…"

/ Fritsl

It’s for the data logger. I
It’s for the data logger. I want to tell the picaxe when the user has aborted the data scan and this can happen while we scan or in the beginning or in the end. If the bloody picaxe could just buffer the data, it could check the buffer at the end of a scan.

an idea

I’m curious to know if you had ever solved this.

I’m not too versed in serial signals, but an interesting idea if it works, would be to use the interupt to detect a signal on the serin pin,

You would also have to set the interupt every time you were finished with a recieve sub command.

 

here is a high level description…

set the interupt to watch the ser in pin.

when the pc wants to send data, send a short string(Helo!)(like a ping to the picaxe) and wait for a recieved signal from the picaxe on the pc side for a go to send.

the picaxe interupt sub will send a serial ack then go to the recieve sub.

get data.

Like I said, not sure how the serial data pin works in this case or if it’s even possible…just a thought.

 

 

Interesting idea. I never
Interesting idea. I never solved the problem. I’ll try your solution, if/when I pick up the project again.

I’m actually working on a

I’m actually working on a project that hopefully will do something similar to what I outlined. The only thing is I’m using an 08m so I can only push serTxd data out, but I can use the interupt to look at a pin and get it’s attention while it’s on its scan loop to tell me if it’s found something yet. the trick will be using the memory efficently since it’s so limited.

I’m hoping to get the parts(4 more 08m’s and an 18x :slight_smile: ) on friday or saturday so I can start the project…

 

 

Handshaking

Does picaxe support hardware handhaking? Using RTS/CTS?

Failing that, you could code software handshaking. If the PC is set to software handshaking, then if the PIC sends Control-S (ASCII character 19) the PC wil lstop sending until it receives Control-Q (ASCII character 17) from the PIC.

Hands up if I’m making sense?

My hand is up. The purpose
My hand is up. The purpose of this was to use it in the java application for graphing the output from the distance sensors. I think it might just a bit overkill to implement software handshake in the robot code, just for some debugging purpose. :slight_smile:

WHAT?
Give over! It’s a piece of cake! When the PIC buffer’s full, send 19 and when it’s empty send 17. It’s not the most complex protocol in the world. In fact, it was invented for use with teletype machines and they didn’t have ANY intelligence at all!!