Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Control System (http://www.chiefdelphi.com/forums/forumdisplay.php?f=177)
-   -   PWM inputs? (http://www.chiefdelphi.com/forums/showthread.php?t=38206)

ghansel 18-05-2005 19:42

PWM inputs?
 
Is there any way for the RC to accept a PWM input?

Matt Krass 18-05-2005 19:44

Re: PWM inputs?
 
I believe there's a way to build a small resistor-capacitor circuit that'll convert the PWM pulse in to a 0 to 5 volt charge that can read through the ADCs. You'll have to get more info from Google or someone else on here though.

Bharat Nain 18-05-2005 19:52

Re: PWM inputs?
 
Quote:

Originally Posted by ghansel
Is there any way for the RC to accept a PWM input?

umm.. Why would you like to do that?

Kevin Sevcik 18-05-2005 22:29

Re: PWM inputs?
 
Presumably you'd have a sensor that has a PWM output or something. A R-C circuit would smooth the signal out into a mostly DC signal.... However, the smoother you get it, the bigger delay there would be in the system. It's probably not terribly relevant if your PWM is high frequency, though.

For direct input, I think you'd need two digital interrupt inputs and a NOT IC. interrupts firing on the rising edge of the signal, so you start a timer when the straight signal fires, and stop the timer when the NOTed signal fires. Voila, the time of the pulse. Then you just need to calibrate the time widths to your data. And account for the delay from the NOT gate if you need real precision or something. It'd act to add a constant amount to your pulse widths, so as long as you calibrate it it shouldn't matter, though. Note that I'm not figuring out if the pulses are wide enough for the controller to measure or if there would be too many interrupts per second for the processor to handle.

ghansel 18-05-2005 22:43

Re: PWM inputs?
 
Quote:

Originally Posted by Kevin Sevcik
Presumably you'd have a sensor that has a PWM output or something. A R-C circuit would smooth the signal out into a mostly DC signal.... However, the smoother you get it, the bigger delay there would be in the system. It's probably not terribly relevant if your PWM is high frequency, though.

For direct input, I think you'd need two digital interrupt inputs and a NOT IC. interrupts firing on the rising edge of the signal, so you start a timer when the straight signal fires, and stop the timer when the NOTed signal fires. Voila, the time of the pulse. Then you just need to calibrate the time widths to your data. And account for the delay from the NOT gate if you need real precision or something. It'd act to add a constant amount to your pulse widths, so as long as you calibrate it it shouldn't matter, though. Note that I'm not figuring out if the pulses are wide enough for the controller to measure or if there would be too many interrupts per second for the processor to handle.


Thanks. I'll see what I can do, and I'll probably post my solution on here when (if?) I finish a PWM/analog converter.

Bharat: http://www.robot-electronics.co.uk/s...CMPS032004.htm

For gyro redundancy.

Thanks to all,
George

Mike Betts 20-05-2005 15:51

Re: PWM inputs?
 
Quote:

Originally Posted by Kevin Sevcik
...For direct input, I think you'd need two digital interrupt inputs and a NOT IC. interrupts firing on the rising edge of the signal, so you start a timer when the straight signal fires, and stop the timer when the NOTed signal fires. Voila, the time of the pulse...

Kevin, et al,

Use DIO3 and use both rising and falling edges as interrupts. Read Port B within the interrupt handler to determine which edge you are processing...

Mike

Kevin Watson 20-05-2005 21:08

Re: PWM inputs?
 
Quote:

Originally Posted by Mike Betts
Kevin, et al,

Use DIO3 and use both rising and falling edges as interrupts. Read Port B within the interrupt handler to determine which edge you are processing...

Mike

This is exactly how the RC decoded the modulated IR signals from 2004. The code in receiver.c would be a great starting point. Receiver.c can be found in edu_tracker.zip and frc_tracker.zip located here: http://kevin.org/frc/2004.

-Kevin

ghansel 14-09-2005 17:57

Re: PWM inputs?
 
Thanks a bunch. Unfortunately (should have posted about it before) we've decided to use an integrator on a gyro instead of a compass.

Thanks anyway,
George


All times are GMT -5. The time now is 20:25.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi