arduino - Wire High&Low Address -


with regards arduino eeprom when writing , reading eeprom devices asks transmission of following format:

wire.begintransmission(addr); wire.write(highaddr); wire.write(lowaddr); wire.write(data); wire.endtransmission(); 

what high address , low address mean? why can not tell write byte @ address 4. why need prove high , low?

it looks me using i2c, going make assumption , base answer off of it. perhaps should clarify eeprom using.

the way i2c works can have 1 master (your arduino) communicate multiple slaves (your eeprom example) on same i2c bus. since possible have multiple slaves connected on same bus, i2c protocol requires specify slave device communicating with. wire.begintransmission(addr) does. selecting device wants initiate communication with. if want communicate eeprom need send address of eeprom (you should able find address in eeprom datasheet).

next, need specify memory location inside eeprom want access. done using 2 bytes highaddr , lowaddr. if instance wanted access address 0x01ab, set highaddr 0x01 , lowaddr 0xab.

the rest simple. send data end transmission.

to summarize:

select device communicate (select eeprom)

wire.begintransmission(addr); 

tell eeprom memory address want write to

wire.write(highaddr);      // send significant address bits wire.write(lowaddr);       // send least significant address bits 

send data write.

wire.write(data); 

end transmission

wire.endtransmission(); 

i recommend reading more how i2c protocol works. http://en.wikipedia.org/wiki/i%c2%b2c#message_protocols


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -