PIC Programming with Linux
I am using a programmer from HOPCO that has been re-wired to use the same parallel port connections as a David Tait-style PIC programmer. The connections for my programmer are as follows:
Vpp control pin 5 inverted logic Vdd control pin 4 inverted logic Clock pin 3 normal logic Data to PIC pin 2 normal logic Data from PIC pin 10 normal logic
The connections for your programmer will most likely be different, depending on the pins it uses to connect to the parallel port and the transistor logic used to implement the on/off control. The configuration menu (see Figure 2) allows you to easily specify which pins are being used and the on/off logic used to control them. Press + and - to switch the logic used for control of each pin.
After you have entered the correct pin number for each function, test it to ensure that the PIC being programmed is seeing the correct logic level. The configuration menu is used for this, too. When one of the control lines is selected using the arrow keys, the O and F keys can be used to turn that control line On and Off. This on and off state is defined from the perspective of picprg, taking into account the polarity you specified when setting up the pins.
Now, get out your trusty voltmeter or whatever you are going to use for detecting power (it should be able to handle at least 13V). Connect the meter's GND to pin 5 on the programming socket. Then select Vpp in the configuration menu and hit O and F to turn it on and off. You should see pin 4 going from 0V to 13V or so (depends on the programmer). Repeat this for each of the pins listed below:
Vpp pin 4 0 and approximately 12 volts Vdd pin 14 0 and 5 volts Clock pin 12 0 and 5 volts Data Out pin 13 0 and 5 volts
The state of the Data In pin on the configuration display should be the same as the state of the Data Out pin. When Data Out is 1, the Data In line should be 1 as well.
Once you have all the voltages swinging the right direction, press S to save the configuration to ~/.picprgrc; type picprg. You are now ready to start using your PIC programmer.
When reading the object file, the ID and FUSE data are taken from the memory locations specified in the configuration menu. Microchip defines this to be 0x2000, but some assemblers place this data in different locations. The configuration menu allows you to specify where in the loaded file the ID and FUSE data will be found. If you are using the picasm assembler, the default values for ID, FUSE and EEPROM location do not need to be changed. They will work correctly right out of the box.
The PIC16C84 has 64 bytes of internal EEPROM data that can be programmed with data like a unique serial number or configuration parameters. This data can be included in the loaded file at the memory location specified by the configuration menu. This address is usually set to 0x2100.
picprg uses the Intel HEX 16 format, which is supported by most assemblers. (I recommend picasm by Timo Rossi.) The FUSE and EEPROM locations can be defined in the configuration menu if your assembler does not put them in the standard locations. picasm also supports the Intel HEX 8 format, and picprg detects this file format automatically. Just type in the file name, and the program will figure out in which format the file was saved.
When an object file is loaded, it is stored in the internal memory buffer. The clock type and fuse states are displayed on the second line of the display while the file is in memory. The clock type and fuse states are determined by looking at the data stored in the FUSE memory location as defined in the configuration menu.
- Readers' Choice Awards 2013
- Linux Kernel News - November 2013
- Mars Needs Women
- Sublime Text: One Editor to Rule Them All?
- RSS Feeds
- Raspberry Pi: the Perfect Home Server
- Advanced Hard Drive Caching Techniques
- December 2013 Issue of Linux Journal: Readers' Choice
- Web Administration Scripts
- New Products
- on the ground
5 hours 27 min ago
- I was able to read the whole
6 hours 56 min ago
- since i have read the title i
10 hours 16 min ago
- Belanja Online Cari Voucher Diskon
10 hours 21 min ago
- The kernel doesn't really
22 hours 32 min ago
23 hours 3 min ago
23 hours 3 min ago
1 day 1 hour ago
- This should be very helpful
1 day 2 hours ago
- As much as I share your point
1 day 4 hours ago