Searching \ for '[PIC]:Help with PWM-in and PWM-out translation' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ios.htm?key=pwm
Search entire site for: 'Help with PWM-in and PWM-out translation'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]:Help with PWM-in and PWM-out translation'
2002\10\16@121317 by OTT,TONY (HP-Roseville,ex1)

picon face
Folks,

I am a relative newbee to PIC programming but here is my question.

I am doing a translation between an input that is a 20ms period, 1.0 to
2.0ms duty cycle PWM signal and two PWM output signals according to the
description below.

The input signal has a center point of 1.5ms and varies between 1.0 and
2.0ms at user discretion (it normally sits somewhere around 1.5ms until user
input changes this). This is translated to two output signals that are
almost identical other than the center position of one of the outputs is
programmable (typically +/-30% of the input center position). I assume this
becomes a simple offset to the output PWM signal for that output. In
addition, the end points are also adjustable for both outputs. Because the
end points are adjustable (1.0ms or greater and/or 2.0ms or less), I need to
linearly translate the input signal that may vary from 1.0ms to 2.0ms to an
output that may have a different center position (say 1.55ms) and end points
that may also be different (say 1.3ms to 1.9ms). The translation should be a
linear translation from input to output and that translation will obviously
be variable depending on how much the end-points have been adjusted for the
output.

Can anyone give me some pointers on how I can do this and the best resources
for existing code. Hopefully my description is adequate. I will be using the
16F87x series as I will need two PWM outputs (both CCP's) driven by the
input PWN signal.

FYI, the application will drive two standard radio controlled servo's so
that both servos travel linearly over the output PWM range.

Thanks


Tony Elliott
Engineering Program Manager
PC Customization Services
Hewlett-Packard Company

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\10\16@123152 by Bob Ammerman

picon face
It sounds like you need something like this:

In = get input pulse width

Out1 = In * scale_1 + offset_1

if (Out1 < Outmin)
   Out1 = Outmin;
if (Out1 > Outmax)
   Out1 = Outmax;

generate output pulse on first output

Out2 = In_pulse_width * scale_2 + offset_2

if (Out2 < Outmin)
   Out2 = Outmin;
if (Out2 > Outmax)
   Out2 = Outmax;

generate output pulse on second output

go back to the top

This is actually simple enough to fit into even an 8-bit PIC, with an
external osc for stability.

You don't need the hardware PWM or CCP modules at all.

Bob Ammerman
RAm Systems

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2002\10\17@034834 by David Harris

picon face
Have a look in the archives: www.piclist.com/techref/io/servo/index.htm
David

"ELLIOTT,TONY (HP-Roseville,ex1)" wrote:

{Quote hidden}

--
David Harris
 OmniPort Home Page:  http://www3.telus.net/OmniPort1/
   Discussion egroup: http://groups.yahoo.com/group/OmniPort
   Swiki:  http://omniport.swiki.net/1

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spam_OUTlistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


More... (looser matching)
- Last day of these posts
- In 2002 , 2003 only
- Today
- New search...