Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

I2C read problem (in slave mode)

Status
Not open for further replies.

pig2

Newbie level 1
Newbie level 1
Joined
Jul 4, 2014
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
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.
":-:)-(
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:

in I2C, only a master could start a frame, that's means, only the master could start a read or write frame.
so in your case, the master need to start by itself the write frame to the salve mcu.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top