Hello Guru's, hope you are all well.
I am currently working on a project that requires one PICAXE to communicate with another when plugged into the circuit. I have my circuit working just fine and the entire system operates excellently other than initial communication not being 100% absolute when initially plugging in a 'slave chip'. Depending on which 'slave chip' is plugged into the circuit, will depend on what functions take place. As it stands, this does work, but only about 98%-99% of the time. When it doesn't work it drops to the 'failed' subroutine seen in the 'slave' CODE.
The connector is 4 pin: +5V, RX, TX, GND.
Below are code snippets that should give you the clear understanding to my dilemma...
I have no doubt in my mind you guys/gals will offer much smarter suggestions, hence why I am here and all ears
MASTER CHIP (14M2) Always Powered:
SLAVE CHIP (08M2) Is Powered when plugged into the circuit
In case you may be wondering, 'serin [33,failed],in,baud,(qualifier),Variable' in the slave CODE '33' is more than enough time. (Tested and checked with a Bitscope).
The Master responds in good time when it has successfully received the SEROUT command from the slave.
I anticipate BG serial receive with interuppt suggestions from you folk, but was hoping to be able to stick with SERIN/SEROUT to avoid a high volume of re-coding.
Regards,
Mort.
I am currently working on a project that requires one PICAXE to communicate with another when plugged into the circuit. I have my circuit working just fine and the entire system operates excellently other than initial communication not being 100% absolute when initially plugging in a 'slave chip'. Depending on which 'slave chip' is plugged into the circuit, will depend on what functions take place. As it stands, this does work, but only about 98%-99% of the time. When it doesn't work it drops to the 'failed' subroutine seen in the 'slave' CODE.
The connector is 4 pin: +5V, RX, TX, GND.
Below are code snippets that should give you the clear understanding to my dilemma...
I have no doubt in my mind you guys/gals will offer much smarter suggestions, hence why I am here and all ears
MASTER CHIP (14M2) Always Powered:
Code:
init:
setfreq m32
#define qualifier "7A654GHDLYSYTN529YN"
symbol baud=N38400_32
symbol in=c.3
symbol out=b.1
symbol CHIP=b0
main:
let CHIP=0
serin [500],in,baud,(qualifier),CHIP
if CHIP=123 then low c.2 sertxd("CHIP1 Detected",cr) gosub chip1 endif
if CHIP=213 then low c.2 sertxd("CHIP2 Detected",cr) gosub chip2 endif
if CHIP=188 then low c.2 sertxd("CHIP3 Detected",cr) gosub chip3 endif
goto main
.
.
.
SLAVE CHIP (08M2) Is Powered when plugged into the circuit
Code:
init:
setfreq m32
#define qualifier "9W654GXDMYSRYN529YN"
symbol baud=N38400_32
symbol in=c.1
symbol out=c.0
symbol CHIP=b0
symbol Variable=b1
pause 6000 'Allow a good second for slave to be fully plugged and seated to socket.
main:
serout out,baud,(qualifier,CHIP)
serin [33,failed],in,baud,(qualifier),Variable
.
.
.
.
failed:
high c.2
end
In case you may be wondering, 'serin [33,failed],in,baud,(qualifier),Variable' in the slave CODE '33' is more than enough time. (Tested and checked with a Bitscope).
The Master responds in good time when it has successfully received the SEROUT command from the slave.
I anticipate BG serial receive with interuppt suggestions from you folk, but was hoping to be able to stick with SERIN/SEROUT to avoid a high volume of re-coding.
Regards,
Mort.
Last edited: