newplumber
Senior Member
Hi to understandable people
I wanted to read my slave 20x2 C.x (C.0-C.7) pins as inputs to be read on the (master 20m2) and
after studing goeytex's sweet post "Communication Between 2 Picaxe 20X2's Using I2C " and other forums
I finally came out of the fog which is one great step for the plumber (I'm DONE searching/reading/googling meanings for this)
So I figured since I have it working with out fire alarms going off I figured I would post my unprofessional code
And I can not believe it is so easy, I was thinking to deep like "send out bytes from slave when master starts to read etc..way off!
But here is my code that i have working
SLAVE CODE picaxe 20X2
MASTER picaxe 20m2
If it needs more work I am sure to correct it but my first IC2 program from chip to chip and thanks
to all picaxe forums
your happy friend
I wanted to read my slave 20x2 C.x (C.0-C.7) pins as inputs to be read on the (master 20m2) and
after studing goeytex's sweet post "Communication Between 2 Picaxe 20X2's Using I2C " and other forums
I finally came out of the fog which is one great step for the plumber (I'm DONE searching/reading/googling meanings for this)
So I figured since I have it working with out fire alarms going off I figured I would post my unprofessional code
And I can not believe it is so easy, I was thinking to deep like "send out bytes from slave when master starts to read etc..way off!
But here is my code that i have working
SLAVE CODE picaxe 20X2
Code:
#picaxe 20x2
#no_data
#no_table
init:
setfreq m16
hi2csetup i2cslave, %10100000
dirsc = %00000000
main:
let b0 = pinsc
pause 100
put 0,b0
goto main
Code:
'picaxe 20M2 master
'#no_data
'#no_table
init:
setfreq m16
hi2csetup i2cmaster, %10100000, i2cfast_16, i2cbyte
main:
gosub read_data
wait 2
goto main
Read_Data:
hi2cin 0,(b0) 'read 1 byte from slave
pause 10
Sertxd ("Read From Slave",cr,lf) 'baud 19200
sertxd (#b0,cr,lf,cr,lf)
return
to all picaxe forums
your happy friend