Hi all,
I'm working on having two picaxe chips (20x2) communicate with i2c. Things are going well but I have a problem.
The master runs this demo code (the final product will have 8 different variables that will change depending on some other sensors):
b1=1
b2=2
b3=3
b4=4
init: hi2csetup i2cmaster, %10100000, i2cslow, i2cbyte
main:
hi2cout 1,b1
hi2cout 2,b2
hi2cout 3,b3
hi2cout 4,b4
pause 500 ; wait a while
goto main
The slave runs the code:
init: hi2csetup i2cslave, %10100000
main:
get 1,b1
get 2,b2
get 3,b3
get 4,b4
wait 1
debug
goto main
The problem I have is I want to get rid of the wait 1 command, for faster throughput. It works down to pause 100 but really any lower than that, the values freeze.
Is this because the slave picaxe can't read and write to the scratchpad simultaneously?
What is a good way to get around this problem? I know I can set a flag, but that is just for any last byte received, isn't it? The slave picaxe needs to know immediately when the last (get 4) value has been updated in order to do some time-critical measuring of sensors.
Thanks for your help!
I'm working on having two picaxe chips (20x2) communicate with i2c. Things are going well but I have a problem.
The master runs this demo code (the final product will have 8 different variables that will change depending on some other sensors):
b1=1
b2=2
b3=3
b4=4
init: hi2csetup i2cmaster, %10100000, i2cslow, i2cbyte
main:
hi2cout 1,b1
hi2cout 2,b2
hi2cout 3,b3
hi2cout 4,b4
pause 500 ; wait a while
goto main
The slave runs the code:
init: hi2csetup i2cslave, %10100000
main:
get 1,b1
get 2,b2
get 3,b3
get 4,b4
wait 1
debug
goto main
The problem I have is I want to get rid of the wait 1 command, for faster throughput. It works down to pause 100 but really any lower than that, the values freeze.
Is this because the slave picaxe can't read and write to the scratchpad simultaneously?
What is a good way to get around this problem? I know I can set a flag, but that is just for any last byte received, isn't it? The slave picaxe needs to know immediately when the last (get 4) value has been updated in order to do some time-critical measuring of sensors.
Thanks for your help!