![]() |
Forum Index : Microcontroller and PC projects : uM I2C read command
Author | Message | ||||
BobD![]() Guru ![]() Joined: 07/12/2011 Location: AustraliaPosts: 935 |
Geoff In the Maximite, when using I2C command I2Crcv there is the capability of combining a write and a read into one I2C command. From Maximite Language Reference V4.4b with the relevant parts in blue. [quote]Syntax I2CRCV addr, bus_hold,rcvlen, rcvbuf [,sendlen,senddata [,sendata .... Examples I2CRCV &h6f, 1, 4, anarray(2), 3, &h12, &h34, &h89 I2CRCV &h6f, 1, 3, anarray(0), 4, anotherarray(0) [/quote] In the Maximite, I find it useful to be able to set a buffer pointer in a chip and then do an immediate read in one line of code. Example: Read register 14 in a DS3231 with the implied write in blue. [quote]I2Crcv &h68,0,1,Reg14_data,1,14 [/quote] The above can be used instead of [code]I2Csend &h68,0,1,14 I2Crcv &h68,0,1,Reg14_data [/code] Does this feature exist in MicroMite Basic? It is not mentioned in the Manual and I am not yet in a position to test. |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3270 |
No, I had to remove it when I was slimming down the I2C routines to get them into the Micromite. So, as you pointed out, you will need to use two separate commands. Geoff Geoff Graham - http://geoffg.net |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |