2 08M2's communication/handshake question

Dangre

New Member
I've been searching around but I guess I'm not using the correct terms. I have two 08M2's talking with each other with interrupts using serin/serout but need to 'store' data in the slave picaxe until the master is ready to use the data. I have ideas on how to increment the data storage location on the slave but do not know how to process the stored data when the master is ready to read the next input. I.E. the slave might have 10 variables that it stored from a keypad input in the time that the master implements a servo command (position) and then is ready for the next input. How do I 'increment' these storage values so I can clear them from the slave when received from the master all the while still inputting data from the keypad. I apologize if I am not clear in what I am trying to do. The comm code I am using is similar to http://letsmakerobots.com/node/3548
 
Last edited:

westaust55

Moderator
You can use the RAM byte pointer (bptr) and the virtual variable (@bptr) to store and retrieve data in the M2 part RAM locations. See PICAXE manual 2 (V7.9) “Variables – General” at page 11.

Use a byte variable to hold the last address previously uploaded to the master and using @bptrinc (post increment) you can save new data onward from that point. When ready to upload more data to the saved locate + 1 is the save for the new data transfer and bptr – 1 is the last location to send.
Keep in mind the standard M2 PICAXE variables use the first 28 bytes of RAM so your code needs to work from byte 29 or 30 upwards. You will alos need to return to RAM location 29/30 when the buffer is cleared and prevent roll over which would corrupt standard variable locations.
 
Last edited:
Top