Specifications

34
Curtis 1310 Manual, Rev. B
Encoder outputs
There are two quadrature encoder inputs. These inputs can detect direction, posi-
tion, and velocity from a pulse train of two channels, offset 90 degrees from each
other. Each encoder input must first be set up for use as a position counter or
as a velocity measurement. After the encoders are set up, the VCL uses special
functions to retrieve the count or velocity (in RPM) of the incoming pulse train. The
setup also allows enabling error detection.
Setup_Encoder(4)
VCL must set up the encoders before they can be used. The Setup_Encoder
function sets the mode, conversion factor, and error detection parameters for the
encoder VCL functions.
Parameters
Enc# Identifies which encoder is to be read (ENC1 or ENC2).
Mode Sets the encoder to Velocity or Count mode, using the
predefined constant ENC_COUNT or ENC_VELOCITY.
Max_PPR Sets either the Pulses Per Revolution or the maximum pulse
error count.
If the mode is ENC_VELOCITY, the value sets the pulses
that are seen in one revolution of the encoder; used to con
-
vert to RPM.
If the mode is ENC_COUNT, the value sets the number of
counts on Channel A that can be tolerated without a count
on Channel B before an error is declared; a setting of 0
disables error checking.
Max_Time Sets the time limit within which the count error (in Max_PPR)
must be reached for an error to be declared. This parameter
is used only in ENC_COUNT mode. Setting Max_Time to 0
means there is no time limit. Time limit = Max_Time × 16ms.
Returns
0 – Setup did not execute.
1 – Setup successful.
Error Codes Bad_ID Incorrect ENC ID was used.
Examples Setup_Encoder(ENC1,ENC_VELOCITY,64,0)
;velocity mode where 64 pulses = 1 revolution
;note the last parameter is don’t care,
;but must be filled with some value.
Setup_Encoder(ENC2,ENC_COUNT,10,10)
;count mode
;if more than 10 counts on one channel without
;any on the other in under 160ms = Error!
5 — VCL