back to FEHIO
Description
Library: FEHIO.h
This object is used to monitor an analog encoder using one of the Proteus’ analog input pins. Once you have declared a variable of type AnalogEncoder and assigned it to one of the 32 Flex I/O pins, you can use the member functions to obtain the counts for your analog encoder or reset your encoder counts to zero. Simply use the “dot” operator to access these member functions. Analog encoders should NOT be used with high speed encoders, like the IG-22 (IGWAN) motor’s built in encoders. If you plan to use multiple encoders, you will need to create a variable of type AnalogEncoder for each encoder that you wish to monitor. Once you’ve created a variable, the Proteus will automagically begin monitoring the encoder, and you can read or reset you encoder counts at any time. Additionally, for each analog encoder that you declare, you must set the “high” and “low” threshold values to tell the encoder what to count as a transition.
For information on port enumerations, see the Hardware section.
Member Functions
int Counts()
void ResetCounts()
void SetThresholds( float, float );
Declaration
AnalogEncoder <variable name>(FEHIO::FEHIOPin);
Example
#include <FEHIO.h> #define LOW_THRESHOLD 0.15 #define HIGH_THRESHOLD 2.25 int main(void) { // Declares an analog encoder on P0_3 AnalogEncoder right_encoder(FEHIO::P0_3); // Set thresholds for the encoder right_encoder.SetThresholds( LOW_THRESHOLD, HIGH_THRESHOLD ); }