?? _readme.txt
字號:
FLAG is an automatic meter-reading protocol popular in the EU.
It is a subset of IEC-1107, also numbered IEC-61107.
It is the predecessor of IEC-62056, which added an HDLC mode to send
large binary blocks.
FLAG is used for reading multiple meters in apartment buildings, via
an EIA-485 twisted-wire bus, and for infra-red reading guns.
It is simple, and small. The FLAG meter-side code here compiles
to about 2.5K per interface, and still gives access to any
data in the meter.
Even though it is small, it has a secure sign-on process,
error-detection and retry logic, and time-out logic
to cope with interrupted meter-reading attempts and the like.
The particular code here provides access to:
A coherent copy of the meter's data registers (reading and
writing are synchronized with the meter's data handling
so that the data is coherent whenever read or written).
The coherent copy of the registers start at address 0 in the XDATA.
this version of FLAG reads and writes anywhere in XDATA, IDATA or SFRs,
including CE registers. The XDATA RAM, CE RAM and XDATA-mapped
IO registers are at their documented addresses.
SFRs are mapped to 0x8000 by the flag interface. IDATA is mapped
to 0x8100 by the flag interface (see the code).
A few custom commands are implemented (e.g. calibration, and update
the registers), just to show how.
The code does not provide some standard FLAG features:
1. Register addresses are absolute, not indirect. We wanted to provide
access to everything. Indirection insulates the HHU code for a meter
model from firmware changes of the meter, and is recommended. Adding an
indirection table should be easy.
2. Meter data is read and written only as hexadecimal. The FLAG interface
converts it to binary on the fly, but only writes it into the meter
after the checksum is verified.
3. The sign-on password is in clear text; In FLAG, each meter vendor is
supposed to provide an encrypted password to sign on. We can't
select your encryption algorithm.
4. There's no partial access levels. Meters usually have signed off
(no access), reader access (reads registerrs, and possibly can set the clock),
and calibration access (read and write everything). The
password usually determines the access level.
5. BAUD rate change logic is not present, although comments
mark the spots we think it should go. We can't integrate with your HHU.
6. The multiple-block read is not supported, because in our reading
of the spec, it appears to lack reliable retry logic.
7. The meter addressing logic (needed for apartment meters) is primitive
to nonexistent, because it would interfere with demonstration of a meter
(our goal). It should be easy to add by changing the sign-on message templates,
and comparing the address in the sign-on. The meter's address would be
assigned during your factory's calibration procedure.
The difference between the code for UART0 and UART1 are basically
whether the .c file includes ser0.h, or ser1.h. Other than that,
both files are identical. We tried to make flag0.c and flag1.c
include a third file, flag.c containing the identical shared logic,
but the Keil compiler loses track of the file name, and then code
can't be debugged in source code. We elected to make it less
elegant, and debuggable.
Some versions of the source may include an unsupported graphic user
interface in Microsoft Visual C that communicates with this version of FLAG.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -