[Menu]>[Guide to use the PIC]


PIC Programmer


Programmer is used to load a program in the memory of PIC. In case of PIC16F84A, the PIC has the feature( ICSP ) to load a program. Programmer is necessary to control ICSP.

Loading for Program Memory
    When assembling a source code with the assembler, HEX file is created.(The extension is .hex)
    The contents of this file are loaded for the program memory of PIC. To load this data in PIC, the following processing is necessary.To load this data in PIC, the following procedure is necessary.
(1)It interprets the contents of the HEX file and it recognizes a memory address and data in the PIC.

(2)It makes the PIC program/verify mode.

(3)It makes voltage (+13V) for program/verify mode.

(4)It changes into the electric signal for which it is possible to receive the PIC.

(5)It transfers data to the PIC according to the ICSP procedure of the PIC.

(6)It checks the contents which were loaded in the PIC.




Data loading environment to PIC
    A personal computer and a programmer and a programmer software are used to load the contents of the HEX file in PIC.

    The process function of the equipment depends on the programmer system.
    (3) and (4) are always done by Programmer. It is sometimes done by Programmer in all the processing after (2).
    Generally, (1), (2), (5) and (6) are done by the personal computer and the progurammer software and (3) and (4) are done by programmer.





Programmer
    "PRO MATE : Universal Device Programmer" and "PICSTART Plus : Low-Cost Development Kitd" are sold from Microchip Inc. as programmer.
    MPLAB can control these programmers directly.

The photograph on the left is PICSTART Plus.

The PICSTART Plus device programmer system consists of the following:
1.PICSTART Plus device programmer
2.RS-232 Interface cable to connect to any standard PC serial port
3.9V power supply
4.MPLAB software, an Integrated Development Environment, including a text editor, project manager, MPASM assembler, and MPLAB-SIM debugger
5.Blank chips for programming





Structure of the HEX file
    HEX file is made with following structure.

    :BBAAAATTHHHHHHHH ............ HHCC
Data
position
MeaningDescription
BBRecord size This is a two digit hexadecimal byte count representing the number of data bytes that will appear on the line.
The data which appear on the line is a maximum of 16 bytes.
When there is more than 16 bytes, a new line is started.
So, the maximum which is shown in BB is '10h'.
AAAAAddress This is a four digit hexadecimal address representing the starting address of the data record.
1 word of the program is 2 bytes.(Because it is 14 bits actually, 2 bits of higher ranks are 0) So, as the address of the program memory, it becomes a 1 bit shifted value.
For example, in case of program address '0001h', it is represented as '0002h' in AAAA.
Behind the 2nd line, it begins from the head of the 16-byte integral multiple.
For example, when the address with record at the head is '000Ch', it is represented in the same record to '000Fh' and is represented at the new record from '0010h'.
:04000C008D018E01D3
:100010008F01900191019201930194019601970142
:08002000980199019A019B016E
:00000001FF
TTRecord type This is a two digit record type that will always be '00' except for the end-of-file record, which will be '01'.
Generally, ':00000001FF' is represented for the end-of-file record.
HHHHData byte This is a two digit hexadecimal data byte, presented in low-byte/high-byte combinations.
In case of '018C', it will be '8C01'.
CCChecksum This is a two digit hexadecimal checksum that is the two's complement of the sum of all preceding bytes in the record.
For example, in case of ':040002008C018C0A', it becomes '129h' when totaling all bytes.
Only the low-byte is effective. The 2's complement of '29h' is 'D7h'. This is put to the end of record as the checksum.
When confirming the normality of the data, it totals all bytes of the record which excluded the checksum and adds the result and a checksum. If the result becomes zero, the data is judged normal. 29h + D7h = 00h ( It ignores a carry )