I2C software library request

10 views
Skip to first unread message

Mike

unread,
Feb 28, 2026, 10:51:01 AM (yesterday) Feb 28
to jallib
The current I2C software library supports three speeds: 1MHz, 400kHz, and 100kHz.  But many aftermarket I2C devices can go much faster than that, such as the small OLED displays.

Long ago I modified my local copy of the library to support an "unlimited" speed and I'm asking that this option be added to jallib.  See below.

Regards,
Mike

procedure  _i2c_wait() is
   
   if i2c_bus_speed == 255 then
      return
   if _i2c_bus_speed == 10 then
      ; i2c_1MHz
      delay_1us()
      return
   elsif _i2c_bus_speed == 4  then
      ; i2c_400kHz
      delay_2us()
      return
   else                          
      ; i2c_100kHz
      delay_5us()
      return
   end if
   
end procedure

Mike

unread,
Feb 28, 2026, 10:56:31 AM (yesterday) Feb 28
to jallib
The code should have been this:

procedure  _i2c_wait() is
   
   if i2c_bus_speed == 255 then
      return
   elsif _i2c_bus_speed == 10 then
      ; i2c_1MHz
      delay_1us()
      return
   elsif _i2c_bus_speed == 4  then
      ; i2c_400kHz
      delay_2us()
      return
   else                          
      ; i2c_100kHz
      delay_5us()
      return
   end if
   
end procedure

Rob CJ

unread,
Feb 28, 2026, 11:18:12 AM (yesterday) Feb 28
to jallib
Hi Mike,

Seems like a good addtion. I updated the library with your suggestion. If you are OK with it, I will add it to Jallib.

I also added some extra info about the bus speeds.

Kind regards,

Rob


Van: 'Mike' via jallib <jal...@googlegroups.com>
Verzonden: zaterdag 28 februari 2026 16:56
Aan: jallib <jal...@googlegroups.com>
Onderwerp: [jallib] Re: I2C software library request
 
--
You received this message because you are subscribed to the Google Groups "jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jallib+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/jallib/5a402fef-1c22-4228-8d65-9caf569c4346n%40googlegroups.com.
i2c_software.jal

Mike

unread,
Feb 28, 2026, 5:14:21 PM (20 hours ago) Feb 28
to jallib
Hi Rob,

I tested the "no delay" speed setting on a 12F683 running on the 8MHz internal oscillator and connected to a 128x32 I2C OLED display and it worked just fine.  I'll try faster (crystals) at some point, as well as the 32MHz internal oscillator of the 12F1840 and 16F1825 that I know I have.

Regards,
Mike

Rob CJ

unread,
3:33 AM (10 hours ago) 3:33 AM
to jallib
Hi Mike,

Thanks for testing. I added the update to Github. I saw that the bee package was already made so it will be in the next version.

Kind regards,

Rob


Van: 'Mike' via jallib <jal...@googlegroups.com>
Verzonden: zaterdag 28 februari 2026 23:14
Aan: jallib <jal...@googlegroups.com>
Onderwerp: Re: [jallib] Re: I2C software library request
 

Mike

unread,
10:20 AM (3 hours ago) 10:20 AM
to jallib
Here's some Sunday morning testing trivia.  I was surprised how slow everything was.
All testing was done on a 12F1840, since it is software selectable up to 32MHz.

Screenshot from 2026-03-01 10-13-42.png
Reply all
Reply to author
Forward
0 new messages