presto_en.pdf - 第83页
Page 83 Saving Device T ype in .hex File Users frequ ently mistook th e selected device type for the device t ype for whic h t he .hex file was saved. To eliminate this, UP conta ins a funct ion allowing you t o save the…

Page 82
5.14.2 Description of
Intel‑HEX File Format
Intel-HEX are text files consisting of lines.
Each line has the following structure:
:LLAAAATTDDDD...CC
„:“ Each line in a file must start with this
character (colon, 0x3A).
LL Length of record (number of DD fields).
AAAA Address of record's first byte.
TT Record type. The types may be:
00 - Data
01 - End of file. Each file must finish with
this record.
02 - Extended segment address. (32-bit
Intel-HEX only)
04 - Extended linear address. (32-bit
Intel-HEX only)
There are also other types like 03 and 05, which are
ignored by UP while reading and not used for saving.
DD Record data. The number of bytes must be
exactly LL.
CC Checksum. The check sum is computed as
a binary supplement to the sum of all
values on the line.
Data Record
A line with the configuration memory of a 14-bit device is
used here as an example.
:02400E00413F30
02 Record length. The configuration memory
size is one word = 14 bit = 2 byte (byte
alignment).
400E Record address. The configuration memory
address is the word 2007h addressed by
bytes, i.e. 400Eh.
00 Record type = data
413F Record data. Configuration word =3F41h
30 Check sum. 30 = 02 + 40 + 0E + 00 + 41
+ 3F = xxD0; neg D0 = 30
End of File
The only acceptable alternative of the End of file line is:
:00000001FF
Extended Linear Address
Only files that need to address more than 64 kB of the
addressed space contain this line.
For example, processors of the PIC18F family have their
configuration memory saved at the address 0x 30 00 00
00.
If this address needs to be used, it is necessary to insert a
line in the .hex file specifying the extended linear
address, i.e. the upper 16 bites of the address. The lower
16 bits are read from the line with the data record.
:020000040030CA
This line selects the configuration memory of PIC18F
family devices.
The extended segment records specify the segment, i.e.
bits 19-4 of the address, which are then added to
addresses from the data records (offset).

Page 83
Saving Device Type in .hex File
Users frequently mistook the selected device type for the
device type for which the .hex file was saved. To
eliminate this, UP contains a function allowing you to save
the device type in a file.
The program adds one more line below the End of File:
#PART=.... The absolute majority of programs working
with Intel-HEX files ignore this line, but such a modified
file cannot be considered as complying with the Intel-HEX
format.

Page 84
6
up_control.dll library
The up_control.dll enables user to control the UP software
using functions contained in the library. It contains basic
programming functions.
From the view of the user the UP software is running
invisibly.
There is more information concerning the library available
in a separate
document.