cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
liwenz
Explorer
Explorer
368 Views
Registered: ‎10-09-2017

how does iic write one byte to its register?

I want to write date to iic's register. I think polled mode in master mode.

I read the polled master example, It uses function: 

Status = XIicPs_MasterSendPolled(&Iic, SendBuffer,
TEST_BUFFER_SIZE, IIC_SLAVE_ADDR);

Where does it send which register in iic device. eg 0x06

IIC_SLAVE_ADDR is device's address, SendBuffer is the data buffer, TEST_BUFFER_SIZE is the count sent,

It should have a send one byte function which include parameters regNo, databyte, IIC_SLAVE_ADDR

how to make it? 

 

0 Kudos
2 Replies
liwenz
Explorer
Explorer
333 Views
Registered: ‎10-09-2017

It seems that XIicPs_MasterSendPolled always write ount bytes data begin with 0x00 register.

Is that right?

I  hope the iic's fifo is register's address and data

0 Kudos
timrprobocom
Visitor
Visitor
319 Views
Registered: ‎12-23-2020

To the IIC bus, the register number is just another byte of data.  IIC doesn't actually have any native concept of registers -- it's just a stream of bytes.  So, what you have is a two-byte write.  Set SendBuffer[0] to your register number, SendBuffer[1] to your data, and write 2 bytes.