⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 encoder.9

📁 CNC 的开放码,EMC2 V2.2.8版
💻 9
字号:
.TH ENCODER "9" "2007-01-16" "EMC Documentation" "HAL Component".de TQ.br.ns.TP \\$1...SH NAMEencoder \- software counting of quadrature encoder signals.SH SYNOPSIS\fBloadrt encoder num_chan=\fInum\fR.SH DESCRIPTION\fBencoder\fR is used to measure position by counting the pulsesgenerated by a quadrature encoder.  As a software-based implementationit is much less expensive than hardware, but has a limited maximumcount rate.  The limit is in the range of 10KHz to 50KHz, dependingon the computer speed and other factors.  If better performance isneeded, a hardware encoder counter is a better choice.  Some hardware-based systems can count at MHz rates..P\fBencoder\fR supports a maximum of eight channels.  The number ofchannels actually loaded is set by the \fBnum_chan\fR argument whenthe module is loaded.  If \fBnumchan\fR is not specified, the defaultvalue is three..P\fBencoder\fR has a one-phase, unidirectional mode called \fIcounter\fR.In this mode, the \fBphase-B\fR input is ignored; the counts increase oneach rising edge of \fBphase-A\fR.  This mode may be useful for countinga unidirectional spindle with a single input line, though the noise-resistantcharacteristics of quadrature are lost..SH FUNCTIONS.TP \fBencoder.update-counters\fR (no floating-point)Does the actual counting, by sampling the encoder signals and decodingthe quadrature waveforms.  Must be called as frequently as possible,preferably twice as fast as the maximum desired count rate.  Operateson all channels at once..TP\fBencoder.capture-position\fR (uses floating point)Captures the raw counts from \fBupdate-counters\fR and performs scalingand other necessary conversion, handles counter rollover, etc.  Can(and should) be called less frequently than \fBupdate-counters\fR.Operates on all channels at once..SH PINS.TP\fBencoder.\fIN\fB.phase-A\fR bit inQuadrature input for encoder channel \fIN\fR..TP\fBencoder.\fIN\fB.phase-B\fR bit inQuadrature input..TP\fBencoder.\fIN\fB.phase-Z\fR bit inIndex pulse input..TP\fBencoder.\fIN\fB.reset\fR bit inWhen true, \fBcounts\fR and \fBposition\fR are reset to zero immediately..TP\fBencoder.\fIN\fB.index-enable\fR bit i/oWhen true, \fBcounts\fR and \fBposition\fR are reset to zero on the nextrising edge of \fBPhase-Z\fR.  At the same time, \fBindex-enable\fR is resetto zero to indicate that the rising edge has occurred..TP\fBencoder.\fIN\fB.counts\fR s32 outPosition in encoder counts..TP\fBencoder.\fIN\fB.position\fR float outPosition in scaled units (see \fBposition-scale\fR).TP\fBencoder.\fIN\fB.velocity\fR float outVelocity in scaled units per second.  \fBencoder\fR uses an algorithm thatgreatly reduces quantization noise as compared to simply differentiatingthe \fBposition\fR output..SH PARAMETERS.TP\fBencoder.\fIN\fB.position-scale\fR float rwScale factor, in counts per length unit.  For example, if \fBposition-scale\fRis 500, then 1000 counts of the encoder will be reported as a position of 2.0units..TP\fBencoder.\fIN\fB.counter-mode\fR bit rwEnables counter mode.  When true, the counter counts each rising edge of thephase-A input, ignoring the value on phase-B.  This is useful for countingthe output of a single channel (non-quadrature) sensor.  When false (thedefault), it counts in quadrature mode..TP\fBencoder.\fIN\fB.x4-mode\fR bit rwEnables times-4 mode.  When true (the default), the counter counts each edgeof the quadrature waveform (four counts per full cycle).  When false, it onlycounts once per full cycle.  In \fBcounter-mode\fR, this parameter is ignored..TP\fBencoder.\fIN\fB.rawcounts\fR s32 roThe raw count, as determined by \fBupdate-counters\fR.  This value is updatedmore frequently than \fBcounts\fR and \fBposition\fR.  It is also unaffectedby \fBreset\fR or the index pulse..SHSEE ALSO\fBcounter(9)\fR

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -