On Tue, 12 Jan 2010, Flying Electron wrote: > Date: Tue, 12 Jan 2010 15:47:34 -0800 > From: Flying Electron <sa...@flyingelectron.com> > Reply-To: "Enhanced Machine Controller (EMC)" > <emc-users@lists.sourceforge.net> > To: "Enhanced Machine Controller (EMC)" <emc-users@lists.sourceforge.net> > Subject: Re: [Emc-users] PWM input to EMC2 > > I've got a pressure sensor that I'd like to use as a probe. The sensor > has a value from 0 - 1023 based on the amount of pressure applied. The > sensor is read by a microcontroller and the microcontroller can generate > a pwm signal based on the sensor value. I was thinking that EMC2 could > read in the PWM signal and reconvert the PWM signal back to a number > from 0 - 1023 which could then be fed into a comparator in HAL to > generate the probe signal. I think doing it this way would allow me to > vary the trip point by varying the comparator input. > > The only two ways I have figured out how to get an analog value into > EMC2 through a parallel port is either PWM input or pulsing an input pin > at a frequency and having an encoder trigger off the pulses and read the > velocity from the encoder. Maybe I am making this too complicated and > there is a simpler way? > > Thanks! > > Sebastian Kuzminsky wrote: >> Flying Electron wrote: >> >>> I've been looking through all the realtime components and haven't seen >>> anything obvious. Is there a component to read a PWM signal in from a >>> parallel port pin? >>> >> >> That's backwards from how we usually do it - pwm generally comes *from* >> emc2, goes *out* the parallel port, and then goes in to a servo amp or >> similar. >> >> What are you trying to do? >> >> >>
Depending on the microcontroller, if you are only using one PWM channel, you may be able to output a variable frequency by changing the PWM resolution. Also, if the required bandwidth is low, you could have EMC randomly sample the PWM input at the base thread rate and low-pass filter the result. In this case you need to chose your PWM frequency so the beats are high enough frequency to filter easily Peter Wallace Mesa Electronics (\__/) (='.'=) This is Bunny. Copy and paste bunny into your (")_(") signature to help him gain world domination. ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users