Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 04:42 29 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : uM I2C read command

Author Message
BobD

Guru

Joined: 07/12/2011
Location: Australia
Posts: 935
Posted: 11:48am 15 Mar 2014
Copy link to clipboard 
Print this post

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: Australia
Posts: 3196
Posted: 01:04pm 15 Mar 2014
Copy link to clipboard 
Print this post

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
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024