SCREENSHOT 2. The Electronics Explorer's virtual LEDs
do not require current-imiting resistors. Better yet, a
single connection between the microcontroller I/O
port and the Explorer is all that's needed to use them.

SCREENSHOT 3. This Electronics Explorer instrument is
yet another way to display the state of the PIC18F46J13's
PORT D I/O pins. Decimal 229 is equivalent to 0xE5 or
11100101 binary.

SCREENSHOT 4. There are many ways to convert the
seven-segment bit patterns to human-readable form.
Here, a caveman shows us how he would do it using
the C switch mnemonic and some bit fields.

SCREENSHOT 5. As you can see, I moved the Explorer
virtual slider from the decimal 94 position to the decimal
156 position.

Screenshot 4 is a representation of the hexadecimal
value 0x0A. Not bad for a caveman.

My Mom always says, “Turn about is fair play.” So, let’s
configure the PIC18F46J13’s PORT D as a digital input port.
Then, let’s configure the Explorer’s Digital 1 solderless
breadboard brick as a digital output port in the form of a
slider. We’ll use HyperTerminal and the PIC18F46J13’s serial
port to display the value presented to PORT D. Again, this is
so easy a caveman can do it:

printf(“%X\r\n”,input_d());

After disabling the binary counter and time display
routines, that’s all we have to add to our existing code. The
results of our folly are depicted in Screenshot 5. Pretty neat,
huh? The Explorer’s logic analyzer is always connected to the
Digital bricks as an input device. What you’re witnessing in
Screenshot 6 is being generated by this CCS C built-in
command:

output_d (counter++);

Note that I’ve configured the logic analyzer to record on
every transitional edge of bit 0. I’m also capturing the bit
patterns in a tabular form that can be exported to programs
like Microsoft Excel for analysis.

Screenshot 7 represents the addition of static I/O bit 31
as a 1.0 kHz clock source. Note that the added clock source
was added to the logic analyzer view. Also note that the
virtual LEDs are doing their thing despite the clock on bit 31.

This Gets Even Better

Check out Screenshot 8. I’ve converted the least
significant bits of the Digital 1 brick from LEDs to various
types of switches. These switch outputs can be used as logic
elements to drive the PIC18F46J13’s I/O pins. The most
obvious switch is the Explorer’s pushbutton switch which is
shown in action in Screenshot 8. I’ve used this line of code