Sunteți pe pagina 1din 16

Aromat Corporation

629 Central Avenue New Providence, NJ 07974 Tel : (908) 464-3550 Fax : (908) 464-5719
Member of Matsushita Group

GT-10 Slave Communication Protocol


The GT-10 can be configured to communicate with a computer or custom board in slave mode by easily selecting the protocol type: General-Purpose Serial mode when you create a new file in GTWIN software. You can use any language such as Basic, C, Pascal, Assembler or anything which can send ASCII strings over RS232C. Creating screens and setting the configuration must be done with GTWIN software. When you select General-Purpose Serial mode (GT slave protocol): All bits are called GR0 GR255F. Total available 4096 bits. Word units are called WGR0 to WGR255. All data is called GDT0-GDT2047. Total available data 2048 words. The data and bit information can be held or stored if you set the GT configuration to do so. Go to File | Configuration | GT configuration. Select Hold GT Device Value tab and select Hold. Default is Unhold. You can create either 256 messages or until you reach 384Kbytes total. CTS and RTS are in effect. *1 1 to 63 station number.
*1 You have to select a Response method. A RS232C to RS485 converter like CNET (AFP85329) is needed.

Protocol format GT Slave protocol (Half-Duplex communication) ASCII strings (One frame is up to 512 characters (bytes).) 19200 bps (or 9600, 38.4K, 57.2K, 115.4K bps ) *1 8 bit data length (or 7 bit ) 1 stop bit fixed *1 Odd parity fixed (or Even, None ) Cr (Carriage Return) fixed: Terminator *2 CTS and RTS hardware hand shake
*1 Configured in GTWIN software under File | GT configuration. Select Communication setting tab. It is under COM Port. *2 If you dont want to use the hardware hand shake, just short CTS and RTS on GT unit. You dont have to control hand shake.
*1

Note: This protocol does NOT swap the upper byte and lower byte like MEWTOCOL.

January 16, 2001

page 1

NAiS

Aromat Corporation
629 Central Avenue New Providence, NJ 07974 Tel : (908) 464-3550 Fax : (908) 464-5719
Member of Matsushita Group

Communication Methods GT Slave protocol has three different methods. 1. Response communication 2. Two way communication 1 3. Two way communication 2 Response Communication Method This is a method where a master device such as PC or custom board, sends command strings to a GT-10 in which it can only issue a response. The GT-10 cannot initiate its own communication. In order to display and update some values changing on the GT-10 screen, you have to keep writing values to the GDT data registers in the unit. To detect if any touch switch was pressed, you will also have to keep sending read commands to the unit. If a Key has been pressed, you will see it in the response. Basically, you have to keep reading to detect Key switch or Data change on the screen. Pros and Cons: Pro1: You get confirmation. Pro2: You can communicate up to 63 GT-10 units. Con1: Slow update time for the key switch because you have to constantly watch if the key is pressed or not. Computer(PC) COMMAND1 GT REPSONSE1 COMMAND2 RESPONSE2 .........

Two Way Communication 1 Method This is a method where the master device such as PC or custom board, sends a command string but the GT-10 does not send a response back. Instead, the unit will send a command string informing the PC or custom board when a key is pressed or data was entered. However, the GT-10 will return a response only when the PC or custom board requests to read a GDT or WGR area. Pros and Cons: Pro1: Faster to detect keys. Con1: You have to control CTS and RTS, so the signals wont collide Con2: You can not have multiple GT displays on a RS485 network. Con3: Since you will not get an acknowledgement, you wont know if data was correctly sent or not. Computer(PC) COMMAND1 GT COMMAND2 COMMAND3 COMMAND4.........

Note1: GT display sends only the following commands. WDW --- Write GDT area in 16 bit(word) unit WRW ---- Write WGR area in 16 bit(word) unit SRW ---- Write single GR bit SRW is the most important command since it is sent by the GT display to a host, PC, or custom board whenever a bit status changes by a touch key. The second important command is WDW. When you change

January 16, 2001

page 2

NAiS

Aromat Corporation
629 Central Avenue New Providence, NJ 07974 Tel : (908) 464-3550 Fax : (908) 464-5719
Member of Matsushita Group

screens from a touch key, a WDW command will be sent to the host, PC or custom board with the new screen number, which is stored in the third GDT area (Default is GDT2.). Note2: If the host, PC or custom board sends a command to read, the GT display will send the data back as the response. Its useful when you want to confirm data in the GT. Two Way Communication 2 Method This is a combination of two methods above. When a master device such as PC or custom board sends command strings, the GT-10 will send a response back every time. However, when a key is pressed to set a bit, the unit will also send a command string to the PC or custom board. Pros and Cons: Pro1: Faster to detect keys. Con1: You have to control CTS and RTS so the signals do not collide. Computer(PC) COMMAND1 GT RESPONSE1 COMMAND3 COMMAND2

RESP..

Note1: GT display sends only following commands. WDW --- Write GDT area in 16 bit(word) unit WRW ---- Write WGR area in 16 bit(word) unit SRW ---- Write single GR bit SRW is the most important command since it is sent by the GT display to a host, PC or custom board whenever a bit status changes by touch key. The second important command is WDW. When you change screens from a touch key, a WDW command will be sent to the host, PC or custom board with the new screen number, which is stored in the third GDT area (Default is GDT2.). Note2: If the host, PC or custom board sends a command to read, the GT display will send the data back as the response. Its useful when you want to confirm data in the GT.

Basic protocol format Maximum number of characters must be less than 512 characters (bytes). COMMAND format ? Station Number Command RESPONSE format ? Station Number Command RESPONSE format on Error ? Station Number NAK ? Text Data Check Code Terminator

Text Data

Check Code Terminator

Error Code

Check Code Terminator

This is a fixed character. All previous uncompleted text strings are ignored when the PLC receives ? which

January 16, 2001

page 3

NAiS

Aromat Corporation
629 Central Avenue New Providence, NJ 07974 Tel : (908) 464-3550 Fax : (908) 464-5719
Member of Matsushita Group

means the beginning of the next command. The completion is recognized by the GT-10 when it receives the terminator. Station Number Two digit decimal number. Default is 01. Configure the station number from 01 to 63 in the configuration by using GTWIN software. On a network, a unique station number must be set on each station. NAK 3 characters in response when any error happens. 3 characters. Refer to each command section.

NAK Command code

Text Data Check code (BCC)

Refer to each command section. The GT Slave protocol uses the BCC (Block check code) sum generated by performing a XOR operation on each string from ? to the last character of text data. This excludes terminator Cr. You can use two asterisks** as a substitute for BCC. It is recommended to use two asterisks instead of BCC if you want to ignore it. The response from the GT-10 will always include the BCC, but you can ignore it. Fixed to Cr(Carriage Return). Refer to error code section page.

Terminator Error code

Recommended format RS232C 19200 bps 8 bit data length 1 stop bit Odd parity Cr (Carriage Return) Command List: Write commands *1 WDW --- Write GDT area in 16 bit(word) unit *1 WRW ---- Write WGR area in 16 bit(word) unit *1 SRW ---- Write single GR bit DDW ---- Write GDT area in 4 bit (digit) unit DRW --- Write WGR area in 4 bit (digit) unit Read commands WDR ---- Read GDT area in 16 bit(word) unit WRR ---- Read word unit GR bits SRR ----- Read single GR bit
*1 These are only commands that the GT-10 sends to a PC or custom board when you select Two Way communication 1or Two Way communication2.

January 16, 2001

page 4

NAiS

Aromat Corporation
629 Central Avenue New Providence, NJ 07974 Tel : (908) 464-3550 Fax : (908) 464-5719
Member of Matsushita Group

Error code 00 -- BCC error 01 -- Format error: GT-10 did not recognize the command format. Usually different length. 02 -- NOT supported error: Command was not correct. 03 -- Address error: When you try to access beyond GDT or WGR area. For example, you cannot access GDT3000 because maximum is GDT2047. 04 -- Receive buffer overflow: GT-10 received more than 512 bytes. 05 -- Requested overflow: GT-10 was requested to send more than 512 bytes. 06 -- Data error: Parity error or framing error occurred.
[Note] If GT-10 could not receive the terminator CR, the unit will keep waiting to receive CR. In that case, send another command. When the GT-10 receives the correct command, it will respond only to the last command.

SET one bit ON/OFF (GR: GT Relay Bit)


COMMAND RESPONSE ?01SRW 0003 1 ** Cr ?01SRW BCC Cr Command sent to station # 01 to set GR3 ON (01). The RESPONSE will be returned to the computer as an acknowledgment. Bit type Element Number GR GT-10 relay bit 2 digits to represents ON (01), OFF (00) Always 4 digits. The least significant digit is in Hexadecimal. Upper three digits are in Decimal. The range has to be from 0000 to 255F. You will get an error code 03 if the element number is out of range.

ERROR ?01NAK error code BCC Cr Refer to error code section page.

Note: In any case, a space cannot be contained in the command code. It is better to include a calculated BCC (Block Check Code) sum in the command code. However, you may substitute ** for the BCC sum since it is much more convenient for testing purposes.

January 16, 2001

page 5

NAiS

Aromat Corporation
629 Central Avenue New Providence, NJ 07974 Tel : (908) 464-3550 Fax : (908) 464-5719
Member of Matsushita Group

WRITE Word unit (Data Register) (GDT: GT Data Register)


COMMAND ?01WDW 0000 0063 E803 C800 9CFF ** Cr
start address 1st value 3rd value number of words 2nd value

(to set 3 words to GDT0 to GDT2) ?01WDW 0100 0004 6400 C800 1027 18FC** Cr (to set 4 words from GDT100 to GDT103) COMMAND RESPONSE ?01WDW 0000 ** Cr ?01WDW BCC Cr Command is sent to station 01 to write values to the GDT area. The above RESPONSE will be returned to the computer if there isnt any error. Word type Element Number GDT and WGR. When you want to read WGR, use WRW instead of WDW. Always 4 digits in Decimal. First number starts from 0. You will get error code 03 if element number is out of range. GDT range: 0000 to 2047 WGR range: 0000 to 0255 Always 4 digits in Decimal. You can write to different number of words in one phrase. If you specify 4 words and you send only 3 data values, you will get error code 02. Always 4 digits per data in Hexadecimal. Upper byte and lower byte are NOT swapped like MEWTOCOL. 0063 is +99 (Dec). E803 is - 6141 (Dec). All numbers are twos complement.

Number of words

Data

ERROR ?01NAK error code BCC Cr Error code is 2 digits. Refer to error code section page. Note: In any case, a space can not be contained in the command code.

January 16, 2001

page 6

NAiS

Aromat Corporation
629 Central Avenue New Providence, NJ 07974 Tel : (908) 464-3550 Fax : (908) 464-5719
Member of Matsushita Group

WRITE Digit (4 Bit) Unit (GDT: GT Data Register, WGR: GT Bit Area)
COMMAND ?01DDW 0000
DGT

3 0

5 5

** Cr ** Cr

address digit value digit number address digit value digit number

?01DRW 0001
WGR

RESPONSE

?01DDW BCC Cr Command is sent to station 01 to write 5 to the most significant digit of GDT3. The above RESPONSE will be returned to the computer if there isnt any error. Word type Element Number GDT and WGR. When you want to read WGR, use WRW instead of WDW. Always 4 digits in Decimal. First number starts from 0. You will get error code 03 if element number is out of range. GDT range: 0000 to 2047 WGR range: 0000 to 0255 Always 1 digit from 0 to 3. 0 is the lowest digit. 3 is the most significant digit. Always 1 digit in Hexadecimal.

Digit number Digit value

ERROR ?01NAK error code BCC Cr Error code is 2 digits. Refer to error code section page. Note: In any case, a space can not be contained in the command code.

January 16, 2001

page 7

NAiS

Aromat Corporation
629 Central Avenue New Providence, NJ 07974 Tel : (908) 464-3550 Fax : (908) 464-5719
Member of Matsushita Group

READ One Bit ON/OFF (GR: GT Relay Bit)


COMMAND ?01SRR 0005 ** Cr
address

(to read GR 5.)

RESPONSE

?01SRR 01 BCC Cr
ON/OFF condition: 01 is ON.

Command is sent to station 01 to read GRA (11 bit). The RESPONSE will be returned to the PC or custom board with either 01 (ON) or 00 (OFF). Bit type Element Number Only GR is available. GR0 to GR255F. Always 4 digits. The least significant digit (right most digit) is denoted in Hexadecimal representing the bit number. Upper 3 digits are Decimal. You will get error code 03 if element number is out of range (for example, GR4000).

th

ERROR ?01NAK error code BCC Cr Error code is 2 digits in Hex. Refer to error code section page.

Note:

In any case, a space can not be contained in the command code.

January 16, 2001

page 8

NAiS

Aromat Corporation
629 Central Avenue New Providence, NJ 07974 Tel : (908) 464-3550 Fax : (908) 464-5719
Member of Matsushita Group

READ Word Unit (GDT: GT Data Register, WGR: GR Relay Bit Word Unit)
COMMAND ?01WDR 0000 0005 ** Cr (to read 5 words from GDT0 to GDT4) ?01WRR 0010 0004 ** Cr (to read 4 words from WGR10 to WGR13) Note: Element number must be expressed in 4 digits for this command. ?01WDR 3412 7856 BC9A F0DE 1234 BCC Cr
GDT0 GDT1 GDT2 GDT3 GDT4

RESPONSE RESPONSE

?01WRR 1234 5678 9ABC DEF0 BCC Cr


WGR10 WGR11 WGR12 WGR13

This example response is for command ?01WDR00000005**. Since the command tries to read 5 words, the GT-10 responds with 5 words in Hex in the order of GDT0 to GDT4 respectively. Also, the maximum number of characters in one frame is 512 including BCC and Cr. Therefore, the maximum number of words you can read at one time is 124 words. If you request more, you will get an error. WGR10 = 1234 (Hex), WGR11 = 5678 (Hex), WGR12 = 9ABC(Hex), WGR13 = DEF0(Hex),
*1

0001 0010 0011 0100(Binary), 4660(Decimal) 0101 0110 0111 1000(Binary), 22136(Decimal) *1 1001 1010 1011 1100(Binary), -25923(Decimal) *1 1101 1110 1111 0000(Binary), -8463(Decimal)

GT-10 uses 2s compliment. The MSB is the sign bit. GDT and WGR. When you want to read WGR, use WRW instead of WDW. Always 4 digits in Decimal. First number starts from 0. You will get error code 03 if element number is out of range. Always 4 digits in Decimal. You can write to different number of words in one phrase. However, if you specify 4 words and you send only 3 data values, you will get error code 02.

Word type Element Number

Number of words

ERROR ?01NAK error code BCC Cr Refer to error code section page. Note: In any case, a space can not be contained in the command code.

January 16, 2001

page 9

NAiS

Aromat Corporation
629 Central Avenue New Providence, NJ 07974 Tel : (908) 464-3550 Fax : (908) 464-5719
Member of Matsushita Group

Communication Update Time


Response time is calculated by the formula below:

Response time = (# of command characters + # of response characters) x (total bit length per character) / baud rate + total idle time
(NCOM + NRES) x NBIT TRES MAX= ---------------------------- + TIDLE baud rate Idle time: Idle time is how long it takes to send the next character one after another.

January 16, 2001

page 10

NAiS

Aromat Corporation
629 Central Avenue New Providence, NJ 07974 Tel : (908) 464-3550 Fax : (908) 464-5719
Member of Matsushita Group

BCC calculation
Horizontal parity code to secure the reliability of transmitted data. It is calculated by performing an XOR operation on each character with the previous result. Example ?01WDW000000014444 BCC Cr This is a command to write 4444 to data register GDT0. character ? 0 1 W D W 0 0 0 0 0 0 0 1 4 4 4 4 ASCII code 3F Hex 30 Hex 31 Hex 57 Hex 44 Hex 57 Hex 30 Hex 30 Hex 30 Hex 31 Hex 30 Hex 30 Hex 30 Hex 31 Hex 34 Hex 34 Hex 34 Hex 34 Hex Result

3F 0F 3E 69

XOR 30 XOR 31 XOR 57 XOR 44 : : : : : : : : : : : : : BCC code

=> => => =>

0F 3E 69 2D

January 16, 2001

page 11

NAiS

Aromat Corporation
629 Central Avenue New Providence, NJ 07974 Tel : (908) 464-3550 Fax : (908) 464-5719
Member of Matsushita Group

ERROR code
An error code is returned with an exclamation point ! in the RESPONSE. The error code is expressed in 2 digits in Hexadecimal format. Basic procedure error 00 BCC error

COMMAND string was not sent from the computer to GT-10 correctly, or BCC code attached with a COMMAND sent from the computer or custom board was not correct. COMMAND string from the computer or custom board is missing some characters or is not correct. There might be lower case letters instead of capital letters or there may not be 4 digits to describe element start/end address for RD/WD command.
?01wdw 0000 0001 4444 **Cr (incorrect) ?01WDW 0000 0001 4444 **Cr (correct)

01

Format error

02

NOT support error

COMMAND string from the computer or custom board does not exist. Check that the COMMAND is spelled correctly. Check that all the characters in the Command string are written in capital letters.
?01WQW 0000 0001 4444 **Cr (correct) ?01WDW 0000 0001 4444 **Cr (correct)

03

Address error

COMMAND from the computer or custom board to the GT-10 is requesting an element that is out of the range. Check the element number.
?01WQW 4000 0001 4444 **Cr (Incorrect)
Its trying to write to GDT4000. GT-10 only supports up to GDT2047. GDT4000 does not exist.

January 16, 2001

page 12

NAiS

Aromat Corporation
629 Central Avenue New Providence, NJ 07974 Tel : (908) 464-3550 Fax : (908) 464-5719
Member of Matsushita Group

Numbering System
All word unit elements use Hex(Binary). 0000 to FFFF in 16 bit. 0000 0000 to FFFF FFFF in 32 bit. The interpretation is 2s complement.

16 Bit
Hex Dec 0001 = +1 0009 = +9 000F = +15 0020 = +32 7FFF = 32,767 8000 = -32,768 FFFF= -1 FFFE = -2

32 Bit
Hex Dec 0000 0001 = + 1 0000 0009 = + 9 0000 000F = +15 0000 0020 = +32 7FFF FFFF = +32,767 8000 0000 = -32,768 FFFF FFFF = -1 FFFF FFFE = -2 0000 FFFF = +65,355 0000 8000 = +32,768 0000 7FFF = +32,767

Floating Point
FP0, FP2, and FP10SH uses 2 words for floating point numbers, an IEEE 754 standard.

ASCII Strings
Two ASCII characters are stored in one word register. The first character goes to the lower byte and the second character goes to the higher byte. ASCII character Hello world ASCII code 48 65 6C 6C 6F 20 77 6F 72 6C 64 Where are they stored? (From GDT9) GDT9 GDT10 GDT11 GDT12 GDT13 GDT14 65 48 6C 6C 20 6F 6F 77 6C 72 00 64

GDT14 GDT13 GDT12 GDT11 GDT10 GDT9


Null

l r

ow

_o

l l

e H

January 16, 2001

page 13

NAiS

Aromat Corporation
629 Central Avenue New Providence, NJ 07974 Tel : (908) 464-3550 Fax : (908) 464-5719
Member of Matsushita Group

Program Tips
Faster up date time Write to a group of data points with one command string instead of sending many different command strings to write one data point at a time. This will increase the communication speed greatly. In order to accomplish this, your control program has to store data in your computer or custom board and then send all of them at once, unless you have to send the value right away. Faster up date time and easy program If possible, just use the GR area only. It has 256 words. If you decide to use 200 words for values, you still have 50 x 16 = 800 bits. The other 6 words can be used as system area. To accomplish this, set the WGR system area in the configuration without overlapping into the area that you are using. Go to GTWIN, under File | Configuration | GT Configuration. Screen does not change by PC or custom board. Why? (1) There are basically two ways to change screens. One way is to write a value to the system area from PC or custom board. The other way is to program a switch on the touch-screen to change screens. Changing screens from the touch-screen will not change the value in the system area. For example, if you write a value 5 to the system area, the screen will change to screen number 5. If you touch a switch to go to screen number 10, the value in the system area will remain at 5. Thus, if you want to go back to screen 5 and you write a 5 to the system area, the screen does not change since it thinks it was already there in the first place. In order to change back to screen 5, you have to read the current screen number and send it to the system area. Therefore, the system area will reflect which screen you are truly on, which is screen 10. Now, if you send a 5 to the system area, it will go to screen 5. Auto Paging sounds easy, but Auto Paging has a higher priority than your instruction. Therefore, while auto paging is working, you cant control the pages from the PC or custom board. We suggest that you do not use auto paging since it also does not change the system area to reflect the current page. Thus, you will experience the same situation as we described above. Screen does not change from the touch key. Why? (1) When Bit E in the first word of the system bit memory area (Default is WGR0) is on, GT-10 shows only the screen number that is stored in the Message Trigger Register (Default is GDT0). An instruction given by a touch key to go to another screen is simply ignored.

January 16, 2001

page 14

NAiS

Aromat Corporation
629 Central Avenue New Providence, NJ 07974 Tel : (908) 464-3550 Fax : (908) 464-5719
Member of Matsushita Group

Wiring
GT RS232C Port ( 5 Pin Screw Terminal ) to Computer

DB9 Pin ( Computer Side)

GT RS232C 5 Pin Screw Terminal

1.CD 2.RD(RX) 3.SD(TX) 4.ER 5.SG 6.DSR 7.RTS 8.CTS 9.RI

1.SD 2.RD(TX) 3.RTS 4.CTS 5.SG

January 16, 2001

page 15

NAiS

Aromat Corporation
629 Central Avenue New Providence, NJ 07974 Tel : (908) 464-3550 Fax : (908) 464-5719
Member of Matsushita Group

GT-10 System Memory Area


Word Device (DT or GDT) N + 0 Message Trigger Register, PLC or PC (All 16 bits) N + 1 (Reserved) N + 2 Displays current screen number (All 16 bits) This information is sent to the PLC from the GT-10. If you are using the GT-10 slave mode with two way communication mode, data will be sent to the external device with a WDW command whenever the screen changes. Bit Device (R or GR) N + 0 Bit 0 - 9 Bit A, B

Bit C Bit D Bit E

N+1 N+2

Bit F Bit 0 - F Bit 0

Bit 1

Bit 2 - F

(Reserved) Back light color bit A B 0 0 : Off 1 0 : Green 0 1 : Red 1 1 : Orange * See Bit D. Controls Back light flash (0 off, 1 on) * See Bit D. Back light valid flag * When this bit is on, Bit A to C will take effect. Force Screen Display Flag * If you want to display the screen number in the message trigger register, activate this bit in the PLC. When this is activated, all touch keys to jump to another screen will be ignored. Controls Buzzer (0 off, 1 on) (Reserved) Data Entry Flag * While data is being entered from the touch screen, this bit turns on. Battery Flag * This flag turns on if the clock data or retentive data value is not properly held by the battery for some reason. (Reserved)

January 16, 2001

page 16

NAiS

S-ar putea să vă placă și