Help with Hserin/Hserout commands?

I have 2 Picaxe 28x1's that will need to communicate serially with one another while each performing tasks such as PWM, reading ADC, simple outputs. As I understand, the Hserin and Hserout pins/commands allow the Picaxes to recieve serial data in the background, store it somewhere, and read the stored data whenever necessary. I need Picaxe A to do tasks, and then send 2 variables to Picaxe B without interupting B's program flow. B needs to be able to look up the variable sent from A whenever necessary and continue on. How would I connect the 2 Hserin/Hserout pairs on each Picaxe? Pretend I want to send the variables b0 and b1 to Picaxe B, with b0 = 3 and b1 = 7, and wanted those to be stored in the background of B, ready to be read by B, what code would I need for Picaxe A and B? I am a complete beginner in serial communication with Picaxes, so the easier to understand, the better :)

Yup, got you covered.

hser rx on one chip goes to hser tx on the other --and vice versa.

From there, well, here you go.

hsersetup B9600_8,%001  ;<–this sets up the hser stuff
setintflags %00100000, %00100000 '<–this will zip down to the interrupt
                                 ’   routine when you get data.

'do main stuff yadda yadda
goto main

pause 20; wait a while to be sure you got everything --may or may not need this
get 0,b1 ;<-- this is the first byte that came in (scratch pad location 0)
get 1,b2 ;<-- this is the second byte that came in (scratch pad location 1);
get 2,b2 ;<–and so on. All the bytes that you receive will get put on
            ;the scratchpad --use “get” to read any or all of them
            ;they come numbered in the order they come in
hserptr = 0 ; reset the background receive pointer (scratchpad pointer)
            ; the next time we get some data, it will get written to the
            ’ scratchpad starting at location 0 --sorta “resets” the system
            ; ready for the next send 
hserinflag=0 ;reset the interrupt flag so you don’t interrupt again
             ;as soon as you leave this subroutine
setintflags %00100000, %00100000 'fire up the int flags again
return ;get back to what ever you were doing

Thanks, I’m going out of

Thanks, I’m going out of town for a few days but will definitely try this once I get back. Thanks again…

Thank you from my side :slight_smile:

 Am trying to communicate with PIC via bluetooth. Got Blue tooth module from

Connected (Rx,Tx,Vcc,Gnd) of bluetooth module to (o/p pin 7, i/p pin 0,V,G ) respectively. Left Reset pin of module on air.(I didn’t get Data sheat of it, So I don’t know wht to do with it).

Attached bluetooth dongle to Lapy. Started Blusloeil software.Started Advanced terminal software. set terminal to (2400,8,1),

Module connected successfully.

Programmed Pic using PIC programming editor.


>> main:

     serin 0,N2400,b1

     serout 7,N2400,(b1)

     goto main

Nothing was coming from PIC. Programmed PIC to count what ever comes into i/p 0. For each second irrespective of what i type in the terminal count is increasing by 1, in debug window.

Tried till batteries ran out. Then saw in the internet that baud rate for module is fixed to 9600. Next saw your reply.

Need to buy batteries and try. Just shared with u, so that you might tell if any thing else I have to do with it. If possible “how to use reset pin on Blue tooth module?” if not, any thing which u suggest.