AllDigital

Download the files here: (Right click and Save As)

The attached .zip has only one file, ALLDIGITAL.pbp extract it to your PBP folder (the one with PBPW.exe)

If you want to use all the pins on your PIC as general Input/Output, you must first enable the DIGITAL inputs that are multiplexed with the ADC and Comparator pins.
MICROCHIP in their infinite(simal) wisdom has DISABLED the DIGITAL inputs on Power-Up. Leaving everyone to figure out which of the 10 different ways they need to use to turn them on for the chip they're programming at any given time.
Sometimes it's ADCON1 and CMCON, other times it's ANSEL and CMCON0, and still others it might take ANSELA ANSELB ANSELC and ANSELD.
This file is an attempt to rectify that situation.
I've tested it on all the common chips we use with PBP, and it workes extremely well.

Simply INCLUDE the file, and all PINs will have any DIGITAL inputs enabled. Whether it's from the A/D converter or the Comparator(s).
A single line will remove that big thorn from your ...

INCLUDE "ALLDIGITAL.pbp"

If you are using MPASM for the assembler, add the following line to your program and the registers that need to be set for the CPU you are compiling for will be shown in the "Results" window of MCS.

DEFINE SHOWDIGITAL 1

For example, with a 16F877A it would show ...

... MESSAGE:(ADCON1 = 7)
... MESSAGE:(CMCON = 7)

At that point, you can just add those lines to your program and delete the INCLUDE line. If it shows a 0x7F type number, change it to $7F.
Or for better compatibility, you can leave the INCLUDE in your program, and it will work with whatever chip you are compiling for.
Here's a simple example for blinking an LED on PORTA.0, without worrying about the analog registers.

INCLUDE "ALLDIGITAL.pbp"

Main:
TOGGLE PORTA.0
PAUSE 500
GOTO Main
Attach:ALLDIGITAL.zip

Page last modified on March 03, 2018, at 12:54 AM