New functions include:
- SetAnalogPort() macro that lets you control the analog/digital setting of an individual pin without having to know the register or which way around it works (0 or 1). Includes ANxx pin definitions for most devices.
- SetAllAnalog() sets all pins to analog mode (the opposite of SetAllDigital). This sub is usually sort of redundant since the pins power up in analog mode, but it was handy while I was testing SetAnalogPort so I left it in.
Some examples:
Code: Select all
device = 18F26K22
include "SetDigitalIO.bas"
SetAllDigital()
// change AN1 and AN2 to analog mode
SetAnalogPort(AN1, ANA)
SetAnalogPort(AN2, ANA)
SetAllAnalog()
// change AN2 to digital mode
SetAnalogPort(AN2, DIG)
If you run across any issues/have any comments (good or bad), drop a note here