EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

PWM to I2C

Started by sturgessb July 11, 2007
Hi Guys

Im having a problem where the need to read 5 channels of PWM is causing my control loop to
run very slowly (for obvious reasons).

So I would like to move this job onto a different IC. I was thinking of perhaps 5 small 8pin
PICS that solely have the job of continuously reading the PWM signal and storing it in a
variable that can be read by my BasicX-24 on via I2C on demand.

Not having any experience with the PIC units, I was wondering if this was possible and
anyone has done it before?

I would also be open to offers to purchase programmed PICs if anyone can do it, as I'm in a
bit of a rush.

Regards

Ben
There's another method available to read PWM signals. A simple RC
circuit can convert the PWM to voltage, which you can then read with
GetADC. The longer the 'on' time for the PWM, the more the capacitor
charges, and the higher the voltage. Certainly not as accurate as
other methods, but it's still 1024 steps of resolution.

Alternatively, you could use another BX24 to do the decoding, and
network the two together. This has the advantage of not having to
bring yourself up to speed on the PIC, as well as expanding your I/O
capabilities.

-Don
--- In b..., "sturgessb" wrote:
>
> Hi Guys
>
> Im having a problem where the need to read 5 channels of PWM is
causing my control loop to
> run very slowly (for obvious reasons).
>
> So I would like to move this job onto a different IC. I was thinking
of perhaps 5 small 8pin
> PICS that solely have the job of continuously reading the PWM signal
and storing it in a
> variable that can be read by my BasicX-24 on via I2C on demand.
>
> Not having any experience with the PIC units, I was wondering if
this was possible and
> anyone has done it before?
>
> I would also be open to offers to purchase programmed PICs if anyone
can do it, as I'm in a
> bit of a rush.
>
> Regards
>
> Ben
>
Ben,
Check Al Willam's PAKs
http://www.awce.com/compare.htm
There might be one that could help.
Mark

--- In b..., "sturgessb" wrote:
>
> Hi Guys
>
> Im having a problem where the need to read 5 channels of PWM is
causing my control loop to
> run very slowly (for obvious reasons).
>
> So I would like to move this job onto a different IC. I was
thinking of perhaps 5 small 8pin
> PICS that solely have the job of continuously reading the PWM
signal and storing it in a
> variable that can be read by my BasicX-24 on via I2C on demand.
>
> Not having any experience with the PIC units, I was wondering if
this was possible and
> anyone has done it before?
>
> I would also be open to offers to purchase programmed PICs if
anyone can do it, as I'm in a
> bit of a rush.
>
> Regards
>
> Ben
>
Ben,
I'm by no means an expert on the BasicX-24, but I have tried using
I2C on this stamp. My understanding is that it is not a hardware I2C
and you have to use ShiftIn and ShiftOut. When I was using it to
communicate with a Devantech SD-21 servo controller, it was slower
that just using the PulseOut command on the BasicX.

Joe

--- In b..., "m_l_newell" wrote:
>
> Ben,
> Check Al Willam's PAKs
> http://www.awce.com/compare.htm
> There might be one that could help.
> Mark
>
> --- In b..., "sturgessb" wrote:
> >
> > Hi Guys
> >
> > Im having a problem where the need to read 5 channels of PWM is
> causing my control loop to
> > run very slowly (for obvious reasons).
> >
> > So I would like to move this job onto a different IC. I was
> thinking of perhaps 5 small 8pin
> > PICS that solely have the job of continuously reading the PWM
> signal and storing it in a
> > variable that can be read by my BasicX-24 on via I2C on demand.
> >
> > Not having any experience with the PIC units, I was wondering if
> this was possible and
> > anyone has done it before?
> >
> > I would also be open to offers to purchase programmed PICs if
> anyone can do it, as I'm in a
> > bit of a rush.
> >
> > Regards
> >
> > Ben
>
Hi Joe

So is simulating I2C is software much slower than hardware I2C?

Ben

The 2024 Embedded Online Conference