Data Exchange Protocol between Language Teacher®
ER586HT Partner® and Personal Computer
Serial port settings
Baud rate |
9600 |
Data bits |
8 |
Parity |
None |
Stop bits |
1 |
I) Data Link Protocol
a) Packet Transmission - Alternate Bit Protocol
All data and commands are divided into packets. Each packet has a byte called packet number, 0x00 or 0x01. For error control in packet transmission. Alternate Bit Protocol (ABP) is used. Mechanism of ABP is stated below:
b) Packet Transmission - Packet Structure
There are two types of packets - COMMAND and DATA. The structure of COMMAND packet is stated below:
|
Bytes |
Value |
Packet Start Field |
1 |
0xFF |
1 |
0x13 |
Packet No |
1 |
0x00 or 0x01 |
Checksum of Command Field |
1 |
|
Command Field |
n |
|
Packet End Field |
1 |
0x10 |
1 |
0x13 |
The structure of DATA packet is stated below:
|
Bytes |
Value |
Packet No |
1 |
0x00 or 0x01 |
Block No |
1 |
|
Size of Data Field |
2 |
|
Data Field |
n |
|
Checksum of Data and Size Fields |
1 |
|
note :
1. checksum = 0
checksum += I I = 0 to n, where I is I th byte
2. Initial Block No = 0
current received block no = previous received block no + 1
range of Block No = 0 to OxFF
с) Types of COMMAND
All commands are composed of ASCII characters. The format of command is stated below:
Command Header |
0x20 |
Command Parameter |
Only three commands have the parameter field. They are "WSYS_ID", "WSYS_TYPE" and "WSYS ERROR.
The following is a list of COMMAND:
"WSYS_LINK" - Request to connect the communication link
"WSYS_ID" - Serial ID Each ID is six bytes, it is consisted of the 6 digits of the serial number of ER586HT. e.g., for serial no. ER58123456,
"WSYS_TYPE" - Data bank type to be sent.
1. "BUS_TEL" - Business Telephone
2. "PER_TEL" - Personal Telephone
3. "MEMO" - Memo
4. "SCHEDULE" - Schedule
5. "ER_DICT" - User's Dictionary
6. "RE DICT" - User's Dictionary
7. "ELECBOOK" - Electronic Book
8. "TEXTTRAN" - Text Translation
Example:
1. When "ELECBOOK" or "TEXTTRAN" has been processed , don't care the serial id in both side.
2. "ELECBOOK" and "TEXTTRAN" has another record format.
"WSYS_DATA" - Ready to send data
"WSYS_EOB" - End of Block (Data bank Type)
"WSYS_EOL" - Request to disconnect the communication link
"WSYS_OK" - Acknowledge the received command
"WSYS_ACK" - Acknowledge the received data packet
"WSYS_NAK" - Negative Acknowledge the received data packet since the checksum of the data is incorrect.
"WSYS_ERROR" - Error Occurs. Each error code is one byte.
The list of error codes is as follows:
1. "0x80" - invalid serial id
2. "0x81" - send data error if the same data packet is sent for a number of times but still "WSYS_NAK" is received.
3. "0x83" - stop PC Sync by either machine (PC or ER586HT)
4. "0x84" - time-out error if the same packet is sent for many times in a specific time but no response received.
note :
1. If either machine, PC or ER586HT, receives the command "WSYS_ERROR" with error code 0x81, 0x83 or 0x84, the process should be ended.
2. For the process uploading data from ER586HT to PC, the packets sent by PC are acted as the acknowledge signal to ER586HT. Therefore the packet numbers of all packet sent from PC should follow the packet number of the packet received previously.
3. For the process downloading data from PC to ER586HT, PC should toggle the packet number before sending a new packet. Also, PC should check the packet received each time if the packet number is valid.
4. If ER586HT receives a command "WSYS_ERROR" with error code 0x80 (It is a new user for PC). It will assign a new pcid for each record of data bank and send all record to PC. Therefore , PC don't break the link.
5. If PC receive a command "WSYS_ERROR" with error code Ox80, it must break the link.
d) Sequence of COMMANDS
The following flow chart shows the sequence of command sent and received by PC when uploading data from ER586HT to PC by using PC-Link;
Process 1
The following flow chart shows the sequence of command sent and received by PC when downloading data from PC to ER586HT by using PC-Link:
Process 2
For the process uploading data from ER586T to PC, the packets sent by PC are acted as the acknowledge signal to ER586HT. Therefore the packet numbers of all packet sent from PC should follow the packet number of the packet received previously.
For the process downloading data from PC to ER586HT, PC should toggle the packet number before sending a new packet. Also, PC should check the packet received each time if the packet number is valid.
The following flow chart shows the sequence of command sent and received by PC when doing PC-SYNC:
II) Data Format
a) Format of Data Field inside a Data Packet
The size of data field of each data packet must not be larger than 1024 bytes. Each data packet may contains several records inside its data field, if the size of the data field of each record is smaller than 1024 bytes.
If the size of the field in a specific record is larger than 1024 bytes, the record will be split into several packets
b) Record Format
RECORD FORMAT 1 of each record is stated as follows:
Name |
Bytes |
Record No |
2 |
Header |
1 |
PCID |
2 |
Size of Content = n |
2 |
COntent |
n |
RECORD FORMAT 2 of each record is stated as follows:
Name |
Bytes |
Size of Content = n |
2 |
COntent |
n |
RECORD FORMAT 1 is applied to the databank types:
b) "BUS_TEL" - Business Telephone
c) "PER_TEL - Personal Telephone
d) "MEMO" - Memo
e) "SCHEDULE" - Schedule
f) "ER_DICT" - User's Dictionary
g) "RE_DICT" - User's Dictionary
RECORD FORMAT 2 is applied to the databank types:
a) "ELECBOOK" - Electronic Book
b) "TEXTTRAN" - Text Translation
1. Record No. (2 bytes)
- The record number in ER586HT.
2. Record Header (1 byte)
- The structure of the header is stated below:
No of bit |
Description |
0 |
Mark bit |
1 |
New bit |
2 |
Modify bit |
3 |
Delete bit |
4-7 |
App used |
MARK bit - specify it is a mark record when it is on.
NEW bit - specify it is a new record when this bit is on.
MODIFY bit - specify it is a modified record when it is on.
DELETE bit - specify it is a deleted record when it is on.
APP USED bits - reserved for Application program used.
3. PCID (2bytes)
- This is a stamp to synchronize the records in PC and ER586HT. The number starts from 0x0001. Each databank type has its own set of PCID.
4. Size (2 bytes)
- Total size of the content in a record
5. Content (Optional)
- The data of the record. In some cases, the content field may be absent.
When performing PC-Link (uploading or downloading) for "MEMO", "USERDICT", the value of fields "Record No." and "PCID" is meaningless, and the content field must be present.
When uploading ALL records from ER586HT to PC for "PER_TEL", "BUS_TEL" or "SCHEDULE", all records in PC of the required databank type should be deleted first. Afterwards the records in ER586HT are uploaded to PC. The value of field "Record No." is meaningless, and field "PCID" is assigned by ER586HT from one to total number of records of the required type.
When downloading ALL records from PC to ER586HT for "PER_TEL", "BUS_TEL" or "SCHEDULE", all records in ER586HT of the required databank type should be deleted first. Afterwards the records in PC are downloaded to ER586HT. The value of field "Record No." is meaningless, and the field "PCID" is assigned by PC from one to total number of records of the required type.
PC-Synchronization
The whole PC-Sync cycle consists of three part: Uploading records to PC, Processing uploaded records in PC, Downloading records to ER586HT.
Part 1 - Uploading records from ER586HT to PC
Three types of records will be uploaded: new records, modified records and deleted records in ER586HT. PC can recognize the record type by the corresponding bits in record header, i.e. NEW bit, MODIFY bit and DELETE bit. There is no field "Content" in deleted records
Part 2 - Processing uploaded records in PC
For each received new record, PC should temporarily store the value in the field "Record No." and assign a PCID to the record. Then PC should add the record content and header into its databank. Remember to reset the NEW bit in the record header before adding the record.
For each received modified record, PC should find out the corresponding record in its databank with the same PCID as in the received record header. PC should replace its record with the received content and header. Remember to reset the MODIFY bit in the record header before replacing the record.
For each received deleted record, PC should find out the corresponding record in its databank with the same PCID as in the received record header, and delete it.
Part 3 - Downloading records from PC to ER586HT
After Part II, PC must first download the PCIDs of the new records from ER586HT. In Part II, PC stored the "Record No." of each received new record. PC should download a record with the following fields for each specific record:
1. Stored "Record No."
2. "Record Header" with NEW bit on
3. "PCID" assigned by PC
4. "Size" equal to 0x0000
5. No "Content" field
After that, PC can download new records, modified records and deleted records remained in PC databank. There are few points to remember:
1. Turn on the corresponding bit for each record before downloading.
2. New records in PC must have "Content" field
3. No "Content" fields in deleted records in PC
Fields limitations
Type of data |
Field No. |
Field Name |
Bytes, max. |
Personal Telephones |
1 |
Name |
30 |
2 |
Telephone Number |
50 |
3 |
Fax Number |
50 |
4 |
Email |
50 |
5 |
Pager |
50 |
6 |
Address |
150 |
7 |
Notes |
150 |
Business Telephones |
1 |
Name |
30 |
2 |
Title |
80 |
3 |
Telephone Number |
50 |
4 |
Fax Number |
50 |
5 |
Email |
50 |
6 |
Address |
150 |
7 |
Notes |
150 |
Memo |
1 |
Title |
100 |
2 |
Content |
2048 |
Schedule |
1 |
Date |
3(date) |
2 |
Start Time |
2(time) |
3 |
End Time |
2(time) |
4 |
Content |
200 |
5 |
Reminder |
2 |
User's Dictionary |
1 |
Headword |
50 |
2 |
Translation |
50 |
3 |
Part Of Speech |
10 |
Note: New line symbol in the textual data has the code 0x0D (not 0x0A 0x0D)
Date and Time encoding
|
Byte 1 |
Byte 2 |
Byte 3 |
Date |
Year |
Month |
Day |
Time |
Hours |
Minutes |
- |
Date:
To get an actual Year we must increment received Year value by 1899. In example, we have Date:
0x64 0x03 0x0F
We adding 1899 to Year and receive date
15-march-1999
Time:
To get an actual Hours or Minutes we must decrement received value by 1. In example, we have Time:
0x08 0x15
We decrement each byte by 1 and receive time
7h 20m
Reminder Encoding
Reminder Value, hex |
Reminder Value (hours and mins) |
0 |
Off |
FF F6 |
10 minutes |
FF E2 |
30 minutes |
FF C4 |
1 hour |
FF 10 |
4 hours |
FE 20 |
8 hours |
FA 60 |
1 day |
EF 20 |
3 days |
Parts Of Speech Abbreviations
Abbreviation |
Full Name |
a |
adjective |
abbr |
abbreviation |
adv |
adverb |
art |
article |
aux |
auxiliary verb |
conj |
conjunction |
id |
idiom |
intrj |
interjection |
n |
noun |
num |
numeral |
phr |
phrase |
pl |
plural |
pref |
prefix |
prep |
preposition |
pron |
pronoun |
v |
verb |
|