Page 1 of 1

new SetDigitalIO module - help wanted

Posted: Sat Sep 12, 2015 3:00 pm
by Jerry Messina
I've added some new functions to the SetDigitalIO.bas module, but before I post it on the wiki I thought I'd give folks a chance to try it out/test it with your favorite chip. There's just too many for me to test them all.

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)
SetAnalogPort only works with chips that allow individual pin control of the analog/digital port configuration.

If you run across any issues/have any comments (good or bad), drop a note here

Re: new SetDigitalIO module - help wanted

Posted: Thu Oct 06, 2016 11:29 am
by Jerry Messina
Just FYI in case anyone runs across this post in the future...

I added the analog functions to the V2.1 download available on the SetDigitalIO wiki page