back to FEHIO
Description
Library: FEHIO.h
This object is used to monitor a digital encoder using one of the Proteus’ digital input pins. Once you have declared a variable of type DigitalEncoder and assigned it to a digital input pin, you can use the member functions to obtain the counts for your digital encoder or reset your encoder counts to zero. Simply use the “dot” operator to access these member functions. Digital encoders should NOT be used with the analog optosensors. If you plan to use multiple encoders, you will need to create a variable of type DigitalEncoder 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.
The constructor function is overloaded to allow both standard declarations and declarations in which the user can select the interrupt edge trigger. The options for interrupt edge trigger are RisingEdge, FallingEdge, or BothEdges. If no interrupt trigger is provided, the default is BothEdges.
For information on port enumerations, see the Hardware section.
P3_6, and P3_7 cannot be used for digital encoders because they are hard-wired to other things on the Proteus!!
Member Functions
int Counts()
void ResetCounts()
Declaration
//standard declaration DigitalEncoder <variable name>(FEHIO::FEHIOPin); //use only if you wish to modify what the encoder counts as a transition DigitalEncoder <variable name>(FEHIO::FEHIOPin, FEHIO::FEHIOInterruptTrigger);
Example
#include <FEHIO.h> int main(void) { //declares a digital encoder on P0_3 DigitalEncoder right_encoder(FEHIO::P0_3); //declare a digital encoder on P2_5 using a falling edge trigger DigitalEncoder left_encoder(FEHIO::P2_5, FEHIO::FallingEdge); }