The text of a manual · part 28 of 37
Sharp Programmable Controller New Satellite JW10 User's Manual: Chapter 13 How to Use Communication Port, pages 217 to 225
Pages 217 to 225 of 307, from Sharp Programmable Controller New Satellite JW10 User's Manual
The original document is the PDF (5.0 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
Filed in the catalog under the Sharp jW-10CM
Page 217
Chapter 13. How to Use Communication Port 13-1 Communication port [1] Function of communication port • The JW10 has a communication port for using any of computer link, data link or remote I/O. • Each function is determined by values set on system memory (#234).
#234 00(H) 01(H) 02(H)
Communication mode Computer link mode Data link mode Remote I/O mode
(1) Computer link mode • The JW10 can communicate to a host computer or an LCD control terminal. (The JW10 can receive host computer's commands and response to the host computer.) • The JW10 can communicate even in stop mode or error mode. (Except communication functional failure.) (2) Data link mode • The JW10 (master) can communicate to the JW10 (salve). (Programless communication) • Even one slave station of the JW10 is not connected, or is in stop mode or error, a master station of the JW10 communicates with other normal slave stations of JW10. (3) Remote I/O mode • The JW10 (master) can communicate to JW10 (slave) as remote I/O. • If one slave station of JW10 is not connected or is error, the JW10 master station stops operation and communication with all the other slave stations.
[2] Wiring
13
• Communication port of the JW10 is L1, L2, and SHLD terminals of the basic module. (Lower terminals of JW-1624K) AC-L AC-N COM.B COM.C COM.D COM.E 405 407 410 412 COM.G 415 417 420 422 424 426 COM.I HLT-C L2 FG 400 401 402 403 404 406 COM.F 411 413 414 416 COM.H 421 423 425 427 HLT L1 SHLD
Insulation tape
(Note 1) Class-3 grounding Twisted wire (Note 2)
• See "6-1 Precautions for wiring." • Make sure to use our recommended shielded twist pair wires for communication lines. Recommended cable: S-IREV-SB 2 × 0.5 (Hitachi Cable Ltd.) Note 1: FG terminal and SHLD terminal are not connected inside. Note 2: Connecting in relay shield of shield cables externally using 0.5 mm2 sectional area or so twisted wires (shorter than 30 mm) offers easy wiring to terminals.
13-1
Page 218
13-2 Computer link [1] Communication specifications • A host computer can communicate with maximum 63 modules of JW10. • With this communication, you can monitor operation, collect data, instruction operation, and change setting value of the connected JW10 modules in personal computer or the like.
Host computer
JW10 (slave station 001) JW10 (slave station 002) JW10 (slave station 077)
RS-232C
RS-232C/422 converter (Z-101HE)
RS-422A Total length max. 1 km
Max. 63 stations
Item
Specifications
Data transfer standard Transfer rate Data style
13
EIA RS-422A or equivalent, Start-stop sychronous system 38400, 19200, 9600, 4800, 2400, 1200, 600, 300 bits/s Start bit : 1 bit Data length : 7, 8 bits Parity bit : 1 bit (odd, even, none) Stop bit : 1, 2 bits Character used ASCII, alphanumeric characters Error check Parity check, sum check No. of stations connected Max. 63 sets Communication line Shielded twisted pair cable. Cable total length: 1 km (party line connection) 2-wire system
[2] Wiring RS-232C/422 converter Z-101HE
Frame ground
FG 1 FG RD(+) Transmit data TD 2 TD RD(-) Receive data RD 3 RD SHIELD Request to send RS 4 RS Signal ground SG 7 SG
JW10 (001)
JW10 (002)
L1 L2
L1 L2
SHLD
SHLD
Class-3 grounding
Class-3 grounding
〜 〜 〜 〜〜 〜〜 〜
Host computer
JW10 (076)
JW10 (077)
L1 L2
L1 L2
SHLD
SHLD Class-3 grounding Class-3 grounding Class-3 grounding Shielded twisted pair cable
Total cable length: Less than 1 km
Less than 15 m RS-232C
RS-422A
Note 1: Do class-3 grounding for SHLD terminal. The operation without class-3 grounding may cause malfunction due to noise. Note 2: Never branch a communication cable into more than 3 lines.
Good
Bad
Conjunction terminal
Connection using a connector
13-2
Page 219
[3] Setting system memory • When using computer link mode, set system memory as follows. #234 Communication mode
00(H): Computer link mode D7 D6 D5 D4 D3 D2 D1 D0 0
#236 Transfer specifications
Transfer rate (300 to 38400 bits/s) Parity (none, odd, even) Stop bit (1 bit, 2 bits) D7 Data length D5 Stop bit 0 0 7 bits 1 bit 1 1 8 bits 2 bits
#237 Local number
Data length (7 bits, 8 bits) D4 D3 Parity D2 D1 D0 Transfer rate (bit/s) 1 1 1 0 0 None 38400 0 0 0 0 1 Odd 19200 0 0 1 1 0 Even 9600 1 1 Disable 0 1 0 4800 0 1 1 2400 1 0 0 1200 1 0 1 600 1 1 0 300
001 to 077(8)
Note 1: Communication mode and station number are set on system memory. We recommend to mark these settings on a label and stick it on each case for easily readable the set contents.
[Example of label]
Computer link #001
[4] Communication format • When the JW10 receives “command” from a host computer, the JW10 executes processing in accordance with its command contents and sends “response” to the host computer. • If an error occurs in the processing contents, the JW10 sends “error response.” ① Command (host computer to JW10) Sum check area A A R S S C D D ? Command content C C I (H) (L) (H) (L) R
② Response (JW10 to host computer) Sum check area A A R S S C D D # Response content C C I (H) (L) (H) (L) R
Error response where an error occurs Sum check area A A R E E S S C D D % C C C C I (H) (L) (H) (L) (H) (L) R
13-3
13
Page 220
(1) Identification symbol ASCII character ASCII code : ? # % CR
3A(H) 3F(H) 23(H) 25(H) 0D(H)
Contents Header (indicates start of command or response) Indicates “command” Indicates “response” at normal operation Indicates “error response” Termination symbol (indicates termination of command or response)
(2) AD(H), AD(L): Slave station number, ASCII character 00 to 77(8) • Inside "command," set ID number of a JW10 slave station attempting to control with 00 to 77(8). • Inside "response," set ID number 01 to 77(8) of a JW10 slave station which is attempted to transmit data to the host computer. • When slave station number is assigned as "00" on writing command such as SRR (set and reset of relays) or WRG (writing to register), all the stations can be simultaneously controlled. This slave station number "00" is called "global address." • For global address usable commands, see "kinds of command" on page 13・7. • A "command" having global address is not given "response." • If global address is assigned to a command which is not available global address, the JW10 does nothing. (It does not return response, either.) (3) RI: Response time, ASCII character 0 to F(H) • Set interval from processing of "command" contents from a host computer to transmitting "response." • Set this time in accordance with processing performance of the host computer. Response Response Response Response RI(H) RI(H) RI(H) RI(H) time (ms) time (ms) time (ms) time (ms) 0 0 4 40 8 80 C 300
1 2 3
13
10 20 30
5 6 7
50 60 70
9 A B
90 100 200
D E F
400 500 600
• Response time in actual use is total of the above setting time and waiting time of PC scan cycle. Ex.: Monitoring relay 02000 of PC01 (in case where scan cycle is 10 ms and response time is 40 ms) Command : : 0 1 ? 4 M R L 0 2 0 0 0 4 F C R Scan cycle 10 ms
Waiting time Receiving command
Set response time 40 ms
Reading
Transmitting response
Note 1: For actual design, you may face the problem of how long a response time should be set. It is not as simply as using an optimum setting time which varies with type of the host computer, kind of programming language, and programming method. Therefore, we recommend to first set a rather long response time. Then, shorten it gradually by testing. Note 2: Number of processing bytes is restricted with some commands. Communication buffer is also restricted with the type of host computer used. Be careful for number of processing bytes.
13-4
Page 221
(4) Sum check codes SC(H), SC(L) • The communication port detects error using sum check as well as parity check in order to increase the reliability. • The contents of the sum check are as follows: 1Add data from slave station No. (AD(H)) to the last data of the command contents or response contents (just before sum check code) that are summed up in ASCII code. 2Convert the sum check code (2 digits hex.) to 8 bits data and add 1 to the result. When the grand total is "00(H)" (disregarded figure up), the message is regarded as correct, when the grand total is not "00(H)," the message is regarded as an error.
Ex.: In case of setting relay 07030 of PC02 (0 as reset, 1 as set). Command which should be sent to a host computer (in case of response time 50 ms) ASCII code 0 2 ? 5 S R R 0 7 0 3 0 1 0 … 30(H) Command contents 2 … 32 Response time (50 ms) ? … 3F 5 … 35 Address (slave station number) S … 53 Add from top address (slave station number) to end of command contents R … 52 at their ASCII code format, and take complement of this total. This is sum R … 52 0 … 30 check code. 7 … 37 Complement of 2 0 … 30 3 … 33 Complement of 2 can be obtained by reversing all of data ex0 … 30 pressed by binary (0 to 1, 1 to 0) and incrementing by one. +) 1 … 31 F8(H)→11111000 2F8(H) ↓ ↓Reversing bit F8(H) 00000111 Complement ↓ of 2 08(H) ↓Add by one 00001000 → 08(H) Therefore, "command" will be as follows: : :
0
2
? 5
S
R
R
0 7 0 3 0 1
0 8
C R
Sum check code When this "command" is received, PC02 sends the following "response." : :
0 2
# 5 S R R 0
7 0 3 0
5 5
C R
Sum check code
After receiving this response, the host computer adds from the top of slave station number to the last of the response contents in their ASCII code format, and adds sum check code "55." If lower 2 digits of the total become "00(H)" (300(H)), the JW10 judges that this response is correct.
ASCII code … 30(H) … 32 … 23 … 35 … 53 … 52 … 52 … 30 … 37 … 30 … 33 … 30 2AB(H) +)Sum check code 55(H) 300(H) 0 2 # 5 S R R 0 7 0 3 +) 0
• If sum check is not needed, set two @ (at sing : 40(H)) on SC(H) and SC(L) positions on the command line. The JW10 does not execute sum check. Even if this is set, the JW10 adds sum check code on response. You may make program to ignore these codes at the host computer.
13-5
13
Page 222
(5) EC(H), EC(L): Error code • When an error occurs, the JW10 sends the following codes as error response. Error code (EC(H), EC(L))
Contents
01
Format error.
02
Designated address is not TMR/CNT setting value.
05
Number of transfer bytes is not correct.
06
JW10 does not stop by HLT (stop PC processing).
07
Writing to JW10 memory is not executed correctly.
0A
Parity error.
0B
Framing error.
0C
Overrun error.
0D
Sum check error.
0E
Prohibit program memory write.
10
Not match write mode.
11
Not program area.
12
Tried to write in ROM.
1B
System memory error.
30
Password is not registered.
31
Secret function is not released.
32
Wrong password is input.
33
Password error (attempted to register characters other than alphabetical and numeric figures).
13
Note 1: In any of the following cases, the JW10 will do nothing and transmit no response. 1) Assigned slave station number in the command and own station number do not match. C 2) If the JW10 cannot find " : " " ? " or " R " in the command. In order to recover from any of these errors, create a program to check by time out with the host computer.
(6) Contents of command and response • See next item "[5] Description of command."
13-6
Page 223
[5] Description of command (1) Kinds of command • Commands are largely classified into read-out command, write command, and control command. Command name
Global address
See page
Relay monitor
MRL
×
13•9
Current value monitor of timer/counter
MTC
×
13•10
Register current value monitor
MRG
×
13•11
Read out program memory
RPM
×
13•13
Read out system memory
RSM
×
13•15
Read out date
MDY
×
13•16
Read out time
MTM
×
13•17
Set/reset relay
SRR
○
13•9
Set/reset timer/counter
SRT
○
13•11
Write in register
WRG
○
13•12
Write the same data in register
FRG
○
13•12
Write in program memory
WPM
○
13•13
Write in system memory
WSM
○
13•15
Change setting value of timer/counter
CTC
○
13•14
Set date
SDY
○
13•16
Set time
STM
○
13•17
Correct, run, and stop clock
ACL
○
13•18
Monitor operation conditions
MPC
×
13•18
Stop PC operation
HLT
○
13•19
Restart PC operation
RUN
○
13•19
Read out write mode status
SWE
×
13•20
Set write mode
EWR
○
13•20
Turn back the message
TST
×
13•21
Release secret/password registration
PAS
○
13•21
Set secret function
SES
○
13•22
Check secret function
SEI
×
13•22
Control command
Write command
Read-out command
Function
Note: For details of "global address" see page 13-4 (2) Write mode • Write mode of JW10 is "mode 0" (write prohibited for all memories) at power ON. Prior to writing program from the host computer, change write mode to "mode 1" or "mode 2" using EWR command (setting of write mode). SWE command read out current status of writing mode. • Set write mode to "mode 0" as much as possible, except when writing data into JW10. • Each mode has restrictions as follow: Mode 0
Write prohibited for all memories
Mode 1
Write enable only for data memory
Mode 2
Write enable for all memories
13-7
13
Page 224
(3) Address expression system • In each command, the setting value in the following table is set in the address module of communication format. Address Setting value Using command (octal)
(octal)
Relay number
00000 to 15777
00000 to 15777
MRL, SRR
Timer/counter point of con-
T000 to T377
T0000 to T0377
MRL tact number
C000 to C377 000 to 377
0000 to 0377
MTC, SRT
コ0000 to コ1577
A0000 to A1577
MRG, WRG, FRG b0000 to b0777
B0000 to B0777
09000 to 09777
09000 to 09777
19000 to 19777
19000 to 19777
29000 to 29777
29000 to 29777
39000 to 39777
39000 to 39777
0000 to 2777
000000 to 002777
0000 to 7777
000000 to 007777
#000 to #377
0000 to 0377
Timer/counter number Register address
Program
JW-1324K/1342K address
JW-1424K/1442K JW-1624K/1642K
System memory address
RPM, WPM, CTC
RSM, WSM
Note: Set with octal notation regardless of setting value on system memory #115. (4) Data expression system • Data are expressed by hexadecimal. Program contents are also expressed by hexadecimal based on machine language. • Contents of bit configuration of program memory is not available.
13
13-8
Page 225
[6] Description of each command MRL
Monitor ON/OFF state of the designated relay.
Command
A S S ・ ・ A D D ? R M R L Relay number C C C I ・ ・ (H) (L) (H) (L) R
Response
A ・ ・ A D D ♯ R M R L Relay number I ・ ・ (H) (L)
Data
Communication format
Function
Relay monitor
S S C C C (H) (L) R
00000 to 15777 Relay T0000 to T0377 (Octal) number 1:ON 0:OFF Data Write mode Mode 0, Mode 1, Mode 2 Execution condition PC operation state Stop, Run
Monitor auxiliary relay 04033 of PC01. (Response time: 40 ms) Example for use
Command
01?4MRL0403347 C R Station Response number time
Response
Relay number
01♯4MRL04033132 C R Station Response number time
SRR
Relay number
ON Sum check code
Set/reset relay Set/reset the relay.
Command
A ・ ・ A D D ? R S R R Relay number I ・ ・ (H) (L)
Response
A S S ・ ・ A D D ♯ R S R R Relay number C C C I ・ ・ (H) (L) (H) (L) R
Data
Communication format
Function
Sum check code
S S C C C (H) (L) R
13
Relay number 00000 to 15777 (Octal) 1: Set 0: Reset Data Mode 1, Mode 2 Write mode Execution condition PC operation state Stop, Run Reset auxiliary relay 07001 of PC03. (Response time: 40 ms) Command Example for use
03?4SRR0700100B C R Station Response number time
Response
Relay number
Sum check code Reset
03♯4SRR0700157C R
Station Response number time
Relay number
Sum check code
Note 1: Relays which are used for input relay, special relay, special register and link system (data link, remote I/O) cannot be set/reset.
13-9