Passing data between 2 PICAXE controllers

dandlion

New Member
Some help/advice please.
What is the easiest/simplest way to pass 1 word (2 bytes) between two PICAXE controllers, one of them being an 08M2? Actually, only the data going TO the 08M2 needs to be 2 bytes - going back the other way just needs to be a signal of some sort to note task completion. I guess this could be just raising an output pin high to generate an interrupt on the other controller. Would Serout/Serin work? I don't want to waste a lot of time if I'm barking up the wrong tree. Thanks for any input/advice you could offer.
 

westaust55

Moderator
Welcome to the PICAXE forum.

The SERIN/SEROUT method works well for your application.
If you do not want the receiving device just waiting you can use the same/pin line to first send a pulse as an interrupt then the receiving end can have the SERIN within an interrupt routine.
 
Last edited:

dandlion

New Member
Thanks for the welcome and the advice. I was wondering what happened if you executed a SERIN and there was no data to be read.
Sorry for being so dumb - but I don't know what you mean by "use the line Ti". Could you elaborate?
How's the weather down there?
 

eclectic

Moderator
@dandlion

1. Have a look at Manual 2, page 204 for info on the Serin timeout.

2. I think westy was referring to using the pin as an ordinary input, initially.
Then when it goes High ("wake up"), it interrupts the program,
and then you can Serin the message.
(Picaxe Postman's knock :)

See Manual 2, page 215 "Setint"

e
 

dandlion

New Member
Thanks! I've got a lot to learn but I'm having fun gettin' there. I want to have my robot done before my next (73rd) b'day.
 

westaust55

Moderator
Yes, eclectic’s belief was correct.
Sorry but was possibly a bit brief while typing on an iPhone.

Concept for the data transfer is:
1. Rx part has the interrupts enabled (SETINT command) to monitor that incoming pin.
2. Tx part sends a pulse over the signal line to indicate a data is about to be sent.
3. Rx part “sees” the pulse and the Interrupt: subroutine is initiated. Which includes the SERIN command.
4. Rx receives the data and can then RETURN to the main program loop to use the data and perform other tasks until a new interrupt occurs.
5. The Rx part can also send a signal back to indicate the actions have been undertaken.
Easiest way is via a send signal line between the two PICAXE.
More complex, but with care and careful programming it could potentially also be done via the same line/wire. May sure to use a resistor in the signal line in case both ends are an output simultaneously.
Suggest that you get it working first with a separate signal line/wire for the response.
 

dandlion

New Member
Great! That's exactly what I want to do.
Thank you soooo much for your patience.
F.Y.I. What I am working on is a way to offload the motor handling duties (direction, speed, distance, etc.) from the main processor in my 2-motor robot to 2 "slaves" - each handling one motor. I'm hoping the 08M2's are up to the task.
 
Top