logo
background
 Home and Links
 Your PC and Security
 Server NAS
 Wargames
 Astronomy
 PhotoStory
 DVD making
 Raspberry Pi
 PIC projects
 Other projects
 Next >>

Programming the PIC

PIC burning
There was a time when PIC's were programmed via the PC's serial port, however these days all 'burners' connect using a USB link. However PC drivers 'emulate' a serial connection via USB, which can lead to some terminology confusion

Using the PICkit

The original Microchip 'burner' was the PICkit-2, the current version is the PICkit-3. Both are designed for 'in circuit' (ICSP) programming. For 'stand-alone' burning you had to pay extra for the add-on ZIF socket.

Clones of the PICkit3 plus the ZIP plug-in option can be found on eBay for a total of about £11 (China).
 
The advantage of the PICkit3 is that it incorporates an 'in-circuit debugger' function and can be driven direct from Microchips software
 
The disadvantage is that the ZIP socket has to be manually set for different PIC types (using DIL pin header links) as it's just a mechanical socket that connects to the ICSP cable (i.e has no 'on board' circuits to select the correct programming pins)

The K150 burner

The K150 was designed as a DIY project stand-alone burner incorporating a 40way ZIF socket and in-circuit burn (ICSP) capability using the included cable. They can now be found on eBay from about £5 (China) to more than double that (from a UK reseller)

No seller bothers to include the 'driver' ('microbrn' tool) and few even mention it. Those that do MIGHT point you to their own web-site where an 'out-of-date' version with a Chinese character GUI can be found :-)
 
However 'microbrn' can be found on any number of sites (even I host it == see below), so all you have to do is Google for it (it's about 367kb as a .zip = anything else and you are being conned into installing an 'adware' infected 'download tool' that will take over your Browser and reset your 'search' engine from Google to something else). There is NO 'microbrn' installer = if you are told otherwise, you are being scammed.
 
The main advantage of the K150 is that the ZIP programming pins are set electronically = so there are no links to get wrong (but you do need to 'align' the PIC correctly in the socket = see later)
 
The disadvantage is that it does not support every PIC (only those defined in the microbrn chipdata.cid file), plus it's not driven direct by Microchips MPLAB 'assembler' software (you have to save the assembled HEX file from MPLAB and use the 'microbrn' utility to load and burn the code)

Using the K150

Start by downloading (Right click and 'Save Link As' to avoid 'File not found' error) the microbrn-K150 programming tool. Unpack to some convenient folder. Double click 'microbrn.exe' to launch the tool. It identifies itself as 'DIY K150 v150807' (or similar). Chances are it will immediately throw an Error claiming that 'There appears to be a problem accessing the COM port'.

Assuming you have the K150 plugged in, you need to go to Control Panel / System,  Hardware tab, Device Manager.
 
Open the 'Ports (COM & LPT)' tree and look for 'Prolific USB-to-Serial Comm Port (COMx)' where x = the number you need to discover.
 
Back in 'microbrn', click on File and select Port from the drop-down list and enter the Port value (it defaults to 4 and has problems with any number bigger than 9)
 
When you 'OK' the change, 'microbrn' should find the K150 (but complain it's 'not responding' and send a Reset)
 
You 'OK' the 'reset' pop-up, but then it usually complains the 'Reset failed ..', however it should by now have identified the K150 by name (shown as 'Mode = [ K150 ]'), so just 'OK' the error pop-up and carry on

The next step is the Load your .HEX program (bit image) file (created by MPLAB). The hex values will appear in the main window (ROM DATA) and the expected PIC part number should appear in the 'Chip Selector' box below the image of the 40pin ZIP (right-hand side window). The ZIF socket image should change to show exactly where the PIC chip should be plugged into

MOST PIC chips are NOT plugged in 'aligned' to pin 1 of the ZIP Socket !

Plug in the chip and click the 'Program' button. A pop-up window will appear asking you to 'Confirm' - click 'Yes' and after a few seconds you should get 'Programming complete'.

The yellow LED on the K150 will come on during programming.
 
You can then 'Verify' if you wish (you should get 'Data verified' information pop-up window after a few seconds)

Note you can use the K150 to program the EEPROM space as well as the FLASH 'instruction' space, however 'microbrn' can have problems with some more modern PIC's.

If the EEPROM fails to verify, chances are it's a timing issue.
 
The EEPROM timing values can be adjusted in the 'microbrn' chipdata.cid (Chip ID) file

Next subject :- PIC in practice

[top]