pig2
Newbie level 1
- Joined
- Jul 4, 2014
- Messages
- 1
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 8
Hello. I have a mcu which is for slave. it connects a sensor.
I would like to use a slave mcu to read the data from the master.
however, there are some problems.
1. I don't know how to check the slave address(from master) it is correct or not.
2. I don't know how to read the data from the master.
I use a MB95F478K as a slave . any ideas???
the following is some code.
slave address i found is 0x52. But I don't know how to match the address from the master.
":--(
"
I would like to use a slave mcu to read the data from the master.
however, there are some problems.
1. I don't know how to check the slave address(from master) it is correct or not.
2. I don't know how to read the data from the master.
I use a MB95F478K as a slave . any ideas???
the following is some code.
slave address i found is 0x52. But I don't know how to match the address from the master.
":--(
Code:
I2C_Start(0x52 |WRITE); // Write Command to ...
I2C_Write(0x52); // ... set address from where to read
I2C_Continue(0x52 | READ); // Restart, with READ command
i = 0;
result[i++] = I2C_Read(); // receive data from EEPROM
result[i++] = I2C_Read(); // receive data from EEPROM
result[i++] = I2C_LastRead(); // receive last byte from EEPROM
I2C_Stop();
"
Last edited by a moderator: