Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 12:35 25 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 : PicoMite MMBasic I2C Command Suggestion / Request

Author Message
DrifterNL

Regular Member

Joined: 27/09/2018
Location: Netherlands
Posts: 58
Posted: 09:20pm 02 Jun 2024
Copy link to clipboard 
Print this post

Just a suggestion / request.
Using the I2C commands I2C(2) WRITE addr, option, sendlen, senddata.... and I2C(2) READ addr, option, rcvlen, rcvbuf
I would like to be able to set the sendlen or rcvlen to 0 (with option auto set to 0) so that just the I2C write address or I2C read address is sent without writing / reading any further data.

[s][I2C Write Address][ack][p]
[s][I2C Read Address][ack][p]

This would make it easier searching the I2C bus for devices, using the general call address 0 and probably a few other things concerning the I2C Bus.

or maybe there is an option already to do this that I overlooked?
Greetings,
DrifterNL
Floating Point Keeps Sinking Me!
Back To Integer So I Don't Get Injured.
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2135
Posted: 10:10pm 02 Jun 2024
Copy link to clipboard 
Print this post

This scanner isn't too complicated (PicoMite):-
> SetPin gp0, gp1, I2C :i2c open 100,1000
> for i=0 to 127 :i2c write i,0,1,0 :If MM.I2C=0 Then :? hex$(i,2):endif:next
57
68
>
 
DrifterNL

Regular Member

Joined: 27/09/2018
Location: Netherlands
Posts: 58
Posted: 10:24pm 02 Jun 2024
Copy link to clipboard 
Print this post

  phil99 said  This scanner isn't too complicated (PicoMite):-
> SetPin gp0, gp1, I2C :i2c open 100,1000
> for i=0 to 127 :i2c write i,0,1,0 :If MM.I2C=0 Then :? hex$(i,2):endif:next
57
68
>


True, but doing it that way you could inadvertently be writing a 0 into an I2C device setup / command / data register.
Floating Point Keeps Sinking Me!
Back To Integer So I Don't Get Injured.
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2135
Posted: 10:45pm 02 Jun 2024
Copy link to clipboard 
Print this post

I don't think any of the devices I have use the first byte for anything.
I assume this is deliberate to prevent scanners affecting anything.

Edit
Or if the first byte is used perhaps it is read-only.
Tested the scanner on everything I have and nothing was affected.

Edit 2
Looked at a couple of datasheets where the first byte is a command or part of a command.
However a value of 0 does nothing on those devices.

There are a number I2C scanners on this forum that use the same method and no one has reported any problems with any device so it seems safe.
Edited 2024-06-03 10:37 by phil99
 
Print this page


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

© JAQ Software 2024