--- On Wed, 3/16/11, andy pugh <[email protected]> wrote:
> From: andy pugh <[email protected]> > Subject: Re: [Emc-users] pwm AD converter > To: "Enhanced Machine Controller (EMC)" <[email protected]> > Cc: "Klemen Dovrtel" <[email protected]> > Date: Wednesday, March 16, 2011, 12:25 PM > On 16 March 2011 08:38, Klemen > Dovrtel <[email protected]> > wrote: > > > I would like to measure some analog signals using emc > (for PID control). I think the easiest way would be to > measure the pwm signal. > > Measuring a PWM digitally is almost never the easiest way. > > > I was thinking i could use two oneshot functions, one > to trigger on rising edge and one to trigger on falling > edge. What i need is a function to measure the time between > those two events - is there a hal function for that? > > I think you could use oneshot set to retriggerable and a > sample-hold > function looking at oneshot.0.time-left and triggered on > the same > pulse. > Note that I said "could" and not "should". The main > drawback is that > the pwm duty cycle measurement will have a granularity > related to your > base-thread time. > > As Visteurs has been saying, voltage-to-frequency with an > encoder > module linked to the signal (in counter-mode) will give > much better > results, it is much less affected by the sample time > granularity. You > would use the encoder-velocity output as your analogue > voltage value. > > Are you using a parallel port, or some other hardware? > > -- I understand it now... i haven't noticed the velocity output (it is not shown on the block diagram). Will use that, thank you :) Yes, i am using the parallel port. The frequency of AD measurement would be approximately 10 Hz. Isn't this low enough to make a decent measurement? Regards Klemen ------------------------------------------------------------------------------ Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d _______________________________________________ Emc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users
