Hi Mike,

OK. If you use any other values than 4, 10 or 255, the library uses 100 kHz 
(same as 1).

Kind regards,

Rob

________________________________
Van: 'Mike' via jallib <[email protected]>
Verzonden: maandag 2 maart 2026 21:17
Aan: jallib <[email protected]>
Onderwerp: Re: [jallib] Re: I2C software library request

Oh, and "undefined" referred to the speed setting not being one of the valid 
options, i.e. not 4, 10, or 255.

On Monday, March 2, 2026 at 3:16:20 PM UTC-5 Mike wrote:
Hi Rob,

The PIC that I used, the 12F1840, has an on-chip Phased Locked Loop and it can 
be enabled in the Configuration Word (what I called the Hardware setting) or by 
setting the appropriate bit in the OSCCON register (what I called the Software 
setting).  I tested both ways in case there was some silicon bug.

The I2C device that I used is a 128x32 OLED display, which I've previously used 
with a different microcontroller (not PIC), and running the I2C clock at more 
than 20MHz.

The 12F1840 does indeed have hardware I2C functionality, but I was deliberately 
testing the I2C Software library to see if "speed=255" was feasible at 
reasonable PIC oscillator speeds.

Regards,
Mike

On Monday, March 2, 2026 at 12:30:32 PM UTC-5 Rob CJ wrote:
Hi Mike,

Some questions. What does PLL HW/SW mean and what does undefined mean?

The speed also depends on the speed of I2C device. If things go too fast, it 
might apply clock stretching to slow down the I2C host. Do you know if that is 
the case?

And would or high speeds I2C hardware be an option?

Kind regards,

Rob

________________________________
Van: 'Mike' via jallib <[email protected]>
Verzonden: zondag 1 maart 2026 16:20

Aan: jallib <[email protected]>
Onderwerp: Re: [jallib] Re: I2C software library request
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]

On Sunday, March 1, 2026 at 3:33:48 AM UTC-5 Rob CJ wrote:
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 <[email protected]>
Verzonden: zaterdag 28 februari 2026 23:14
Aan: jallib <[email protected]>
Onderwerp: Re: [jallib] Re: I2C software library request

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


On Saturday, February 28, 2026 at 11:18:12 AM UTC-5 Rob CJ wrote:
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 <[email protected]>
Verzonden: zaterdag 28 februari 2026 16:56
Aan: jallib <[email protected]>
Onderwerp: [jallib] Re: I2C software library request

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

On Saturday, February 28, 2026 at 10:51:01 AM UTC-5 Mike wrote:
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


--
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/jallib/5a402fef-1c22-4228-8d65-9caf569c4346n%40googlegroups.com<https://groups.google.com/d/msgid/jallib/5a402fef-1c22-4228-8d65-9caf569c4346n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/jallib/5c386650-0eb8-4b9d-ba00-333ca4fee698n%40googlegroups.com<https://groups.google.com/d/msgid/jallib/5c386650-0eb8-4b9d-ba00-333ca4fee698n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/jallib/0eca8088-1242-4390-b996-b5169a4b25a2n%40googlegroups.com<https://groups.google.com/d/msgid/jallib/0eca8088-1242-4390-b996-b5169a4b25a2n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
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 
[email protected]<mailto:[email protected]>.
To view this discussion visit 
https://groups.google.com/d/msgid/jallib/fb673cfd-32fa-41ec-8a6c-6cc1aecc983fn%40googlegroups.com<https://groups.google.com/d/msgid/jallib/fb673cfd-32fa-41ec-8a6c-6cc1aecc983fn%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/jallib/GVXPR02MB1209818B082B8CC2D816EADF6E67FA%40GVXPR02MB12098.eurprd02.prod.outlook.com.

Reply via email to