<<Previous

Next>>

2.5. Program That PICmicro

There are two steps left - putting your compiled program into the PICmicro microcontroller and testing it.

The PICBASIC™ Compiler generates standard 8-bit Merged Intel HEX (.HEX) files that may be used with any PICmicro programmer including our EPIC Plus Pocket PICmicro Programmer. PICmicro MCUs cannot be programmed with the BASIC Stamp programming cables.

The following is an example of how a PICmicro MCU may be programmed using our EPIC Programmer.

Make sure there are no PICmicro MCUs installed in the EPIC Programmer programming socket or any attached adapters.

Hook the EPIC Programmer to the PC parallel printer port using a DB25 male to DB25 female printer extension cable.

Plug the AC adapter into the wall and then into the EPIC Programmer (or attach 2 fresh 9-volt batteries to the programmer and connect the "Batt ON" jumper.)

The LED(s) on the EPIC Programmer may be on or off at this point. Do not insert a PICmicro MCUs into the programming socket when the LED is on or before the programming software has been started.

From Windows, start EPICWin. EPICWin is the 32-bit Windows version of the programming software and should be used with Windows 95, 98, ME, NT, 2000 or XP.

If you only have DOS or Windows 3.1, use the DOS version of EPIC. The EPIC DOS software should be run from a pure DOS session. The EPIC DOS software only supports a limited number of PICmicro MCUs. Use EPICWin for programming the latest PICmicro microcontrollers. See the EPIC readme file for the complete support list.

The EPIC software will take a look around to find where the EPIC Programmer is attached and get it ready to program a PICmicro MCU. If the EPIC Programmer is not found, check all of the above connections and verify that there is not a PICmicro MCU or any adapter connected to the programmer.

Once the programming screen is displayed, use the mouse to click on Open file. Select BLINK.HEX or another file you would like to program into the PICmicro MCU from the dialog box.

The file will load and you can look at the Code window to see your PICmicro MCU program code. You should also look at the Configuration window and verify that it is as desired before proceeding. 

In general, the Oscillator should be set to XT for a 4MHz crystal and the Watchdog Timer should be set to ON for PICBASIC™ programs. Most importantly, Code Protect should be OFF when programming any windowed (JW) PICmicro MCUs. You may not be able to erase a windowed PICmicro MCU that has been code protected. You can find more information on these configuration fuses in the Microchip data sheet for the device you are using.

When it all looks marvelous, it is time to insert a PICmicro MCU into the programming socket and click on Program. The PICmicro MCU will first be checked to make sure it is blank and then your code will be programmed into it. If the PICmicro MCU is not blank and it is a 16F84 or other flash or EEPROM device, you can simply choose to program over it without erasing first.

Once the programming is complete and the LED is off, it is time to test your program.

2.6. It's Alive

The sample schematic below gives you an idea of the few things that need to be connected to the PICmicro to make it work. Basically all you need is a pull-up resistor on the /MCLR line, a 4MHz crystal with 2 capacitors, and some kind of 5-volt power supply. We have added an LED and resistor to provide the output from the BLINK program.

Build and double check this simple circuit on a breadboard and plug in the PICmicro you just programmed. Our line of PICProto prototyping boards is perfect for this kind of thing.

Connect a power supply. Your PICmicro should come to life and start blinking the LED about once a second. If it does not blink, check all of the connections and make sure 5 volts is present at the appropriate pins on the PICmicro.

From these simple beginnings, you can create your own world-conquering application.

<<Previous

Next>>