Chris Radek wrote: > On Wed, Sep 15, 2010 at 12:42:55PM -0500, Jon Elson wrote: > >> The PPMC >> driver takes a +/- 1.0 value and multiplies it by 10 to give a +/- 10 V >> output range. >> > > Are you sure? I was looking at the pwmgen code earlier instead of the > dac code (not sure how these differ) Well, quite a lot, in some regards. > and I *think* pwmgen full scale > value at the hal input pin is +-1 and dac full scale value at the hal > input pin is +-10. > Yes, probably all historical, (or is that hysterical), and it looks like you are right. Might be a big problem to change it now, maybe better to just document the discrepancies. > I think this means the scale I suggested is off by a factor of 10 > (should have been 0.889 instead of 8.89). Here's the relevant code > from the ppmc driver: > > volts = *(pg->value) / pg->scale; > dc = (long) (((volts / 10.0) * 0x7FFF)+0x8000); > > Confusingly, I think we have > > PPMC: > output in volts = value / scale > > Hostmot2: > output in volts = 10 * (value / scale) > > STG: > output in volts = (value - offset) * scale > So, basically, it follows the STG code, which was the only analog servo driver
when the PPMC was developed. So, it is perfectly consistent with that. Now, if you use the OUTPUT_SCALE of 0.889, and PID is limited to +/- 1.0 as the maximum range, it will limit the DAC output to +/-1.12 V. Is this reasoning right? The limit of the PID output is set by parameter pid.n.maxoutput which is set (in my sample files) by ini parameter PID_MAXVEL, not a really accurate description. I have it set to 12.0, which also looks wrong! Ah, but so you need to set the pid.n.maxoutput to 10.0 if you want to get 10 V out of the DAC, or you can set pid.n.maxoutput to 1.0 and then set OUTPUT_SCALE to 0.1 Hmmm, neither of these is totally self-explanatory, is it? Documenting some of this crap would help, though. I am painfully aware that compared to some of the other documentation on hal drivers, the PPMC is AWFULLY terse. You must know this as you are using "the source IS the documentation". Jon ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users