THE LATEST IN PROGRAMMING MICROCONTROLLERS
GETTING STARTED WITH
■ BY CHUCK HELLEBUYCK
PROGRAMMING THE PICDEM 2
PLUS DEVELOPMENT BOARD
I received a message from a person who had purchased a Microchip
PICDEM™ 2 Plus Development Board (see Figure 1) from www.microchip
direct.com but was confused on how to get started. The person thought
this would be a great board to start with because of all the features it offers,
including an LCD, EEPROM, piezo buzzer, LEDs, switches, potentiometer, and
serial port. The board also has a voltage regulator and nine volt battery clip.
I have to agree, it’s a great board to start with. However, it was the “getting
started” part that he was seeking help with. He wanted to program using the
PICBASIC PRO™ compiler because he read about it here, but he couldn’t find
any PICBASIC PRO example code or documentation included with the board.
I helped him with some sample code, but had to admit that it wasn’t written
specifically for the PICDEM 2 Plus board. He was happy with the help and is
busy programming his board.
This led to a discussion with a friend about how quickly I could write some sample code dedicated to this
development board. We made a list of possible project
ideas, which included the following:
7. External interrupt.
8. Read and write to EEPROM.
9. Communicate via RS-232.
1. Flash an LED.
2. Scroll the four LEDs.
3. Drive the LCD.
4. Read a potentiometer with an Analog-to-Digital
5. Drive the piezo buzzer.
6. Sense the momentary switches.
After looking over the list, I estimated that I could
write PICBASIC PRO code for all of these projects in less
than four hours. The programs would be simple and
would get the job done. They would also be simple
enough to fit within the 31 command-line limit of the
PICBASIC PRO sample version. The challenge was on.
What I didn’t tell my friend was that I planned to make
maximum use of the example code that comes with the
PICBASIC PRO sample version to start each project,
and then just modify it to work with the PICDEM 2 Plus
board. This would still require some work adjusting of
the connections, but it would save me time compared
to starting from scratch. This would still require some
work adjusting the code for the PICDEM 2 Plus
connections (shown in Figure 4), but it would save me
time compared to starting from scratch. In the end, I
altered the sample code quite a bit, but it was fairly
easy to accomplish this challenge.
After getting everything set up — I used an
MPLAB® ICD 2 for the programming tool because it is
available bundled with the PICDEM 2 Plus board — I
was ready to write some code. I was able to get all nine
■ FIGURE 1. PICDEM™ 2 Plus Development Board.