Pictou
Member level 1
- Joined
- Mar 19, 2013
- Messages
- 34
- Helped
- 5
- Reputation
- 14
- Reaction score
- 5
- Trophy points
- 1,288
- Activity points
- 1,570
What do you mean? you think you can't use multiple slaves?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
My current problem is two salve but do not have a solution,What do you mean? you think you can't use multiple slaves?
Well I didn't follow all the code and I'm not familiar with I2C, but what I see is the following : you have 2 slaves, with 2 adresses. How did you get these adresses?
that is, now I have to processing with the master???Okay, now that you have the adresses, how does the communication work?
In OneWire, the master had to tell ALL the slaves that he is going to call ONLY ONE and the slave had to pay attention as the adress was being "spelled" by the master.
How does it work with your system? Does the master also tell the slaves to "listen" to the bus while he calls someone?
unsigned int read_slave(void) {
unsigned int dulieu;
i2c_start(1);
i2c_write(0x10);
dulieu=i2c_read();
i2c_stop();
return dulieu;
}
unsigned int read_slave2(void) {
unsigned int dulieu2;
i2c_start(1);
i2c_write(0x40);
dulieu2=i2c_read();
i2c_stop();
return dulieu2;
}
I tried but not, master dislay 255 @@@Khanh: Have you tried the things I mentioned in post 18? Please go through the items in post 18 and let me know the results.
For the slave I2C setup, you may want to try the FORCE_HW option. The slaves may require it.
#use i2c(slave,sda=pin_c4,scl=pin_c3,address=0x10, FORCE_HW)
#use i2c(slave,sda=pin_c4,scl=pin_c3,address=0x40, FORCE_HW)
Thanks you very much!@khanh my Don't worry. I have found a solution to your problem. I will write a working code and post it tomorrow.