The text of a manual · part 13 of 25
Bulletin 5370 CVIM Configurable Vision Input Module Communications Manual: 5 - Using the RS-232 Ports, pages 98 to 106
Pages 98 to 106 of 202, from Bulletin 5370 CVIM Configurable Vision Input Module Communications Manual
The original document is the PDF (723 KB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Allen-Bradley 5370-CVIM
Page 98
Chapter 5 Using the RS–232 Ports
ACK/NAK, BCC Characters
After receiving a DF1 data packet, the CVIM module validates the Block Check Character. Note: The block check character is a technique used to check the integrity of of data packet. BCC are explained in the next section. Depending upon whether or not the BCC is validated, the following will occur: If the BCC is not acceptable, the CVIM module will reply with a DLE NAK (Negative Acknowledgment) character and discard the data packet. If the command has an acceptable BCC the CVIM module will reply with a DLE ACK (Positive Acknowledgment) character and try to execute the command. After receiving a data packet and validating the BCC, one of the following will occur. If data packet has a valid BCC but the CVIM module cannot execute the command the CVIM module will discard the data package. No message is returned. The host should be set to time out after waiting for a response. If the command can be executed, the CVIM module will respond with any returned data packets. After receiving the data, the host should respond with a DLE ACK to let the CVIM module know that the message was received properly. If the host returns a DLE NAK, the CVIM module will retransmit the data up to three times before discarding the data packet. Note: Some commands request a continuous flow of data from the CVIM module. You can stop the flow of data by sending another command. Note: A simple way to test the RS–232 links is to send the CVIM module a DLE ENQ (enquiry). If you have the port properly connected and the CVIM module is configured for RS–232, the CVIM module should send a DLE ACK or DLE NAK in response. If no response is provided, check your connections and CVIM module configuration.
Block Check Character
5–28
The block check character (BCC) is a means of checking the accuracy of each message packet transmission. It is the 2’s complement of the 8–bit sum (modulo–256 arithmetic sum) of all data bytes between the DLE STX and the DLE ETX BCC. It does not include any other message packet codes or response codes.
Page 99
Chapter 5 Using the RS-232 Ports
For example, if a message packet contained the data codes 8, 9, 6, 0, 2, 4, and 3, the message packet codes would be (in hex):
10
02
DLE STX
08
09 06 00 02 04 03 10
Data
03
E0
DLE ETX BCC
The sum of the data bytes in this message packet is 20 hex. The BCC is the 2’s complement of this sum, or E0 hex. This is shown in the following binary calculation:
0010 1101
000020 hex 11111’s complement +1
1110
00002’s complement (E0 hex)
To transmit the data value 10 hex, you must use the data code DLE DLE. However, only one of these DLE data bytes is included in the BCC sum. For example, to transmit the values 8, 9, 6, 0, 10, 4, and 3 hex, you would use the following message codes:
Represents single data byte value of 10 10
02
DLE STX
08 09 06 00 10 10 04 03
Data
10
03
D2
DLE ETX BCC
In this case, the sum of the data bytes is 2E hex because only one DLE text code is included in the BCC. So the BCC is D2 hex. The BCC algorithm provides a medium level of data security. It cannot detect transposition of bytes during transmission of a packet. It also cannot detect the insertion or deletion of data values of zero within a packet.
5–29
Page 100
Chapter 5 Using the RS–232 Ports
Deactivate Forces
Use the deactivate force command to return outputs on the 1771–JMB local I/O board to the CVIM module assigned functions. The deactivate forces command is:
If the BCC is not valid, the CVIM module will respond with a DLE NAK and the command will not be executed. If the BCC is valid, the CVIM module will respond with a DLE ACK. Then the CVIM module will validate the command structure. If the command is valid, the CVIM module will execute the command and return the data. If the command structure is invalid, the CVIM module will not execute the command or respond.
Echoing Data
Use the echo command to check the communications link. This command will return the same same string of characters that are sent out with the command. This command has the following structure: 01
00 n times
Data
Where n times specifies the number of times the CVIM module will echo the data field back to the host device. There is no object associated with this command. The command is valid at any time. For example: 01
This example will cause the CVIM module to return the string: DLE ACK DLE STX 1234512345123451234512345 DLE ETX BCC If the BCC is not valid, the CVIM module will respond with a DLE NAK and the command will not be executed. If the BCC is valid, the CVIM module will respond with a DLE ACK. Then the CVIM module will validate the command structure. If the command is valid, the CVIM module will execute the command and echo the data. If the command structure is invalid, the CVIM module will not execute the command or respond. 5–30
Page 101
Chapter 5 Using the RS-232 Ports
Enable/Disable Outputs
Use this command to enable or disable discrete outputs or local Outputs I/O. Use the following commands: This command disables the outputs.
This command enables the outputs.
If the BCC is not valid, the CVIM module will respond with a DLE NAK and the command will not be executed. If the BCC is valid, the CVIM module will respond with a DLE ACK. Then the CVIM module will validate the command structure. If the command is valid, the CVIM module will execute the command. If the command structure is invalid, the CVIM module will not execute the command or respond.
Forcing Local I/O
Use the force command to turn the local I/O outputs either on or off. This function can only be executed once per command. The only valid objects are the fourteen discrete outputs. This command has the following structure:
Where the flags specify outputs 1 through 14:
Set individual Bits to select outputs 1 through 14
The data in this command indicates on or off (1 = ON and 0 = OFF).
5–31
Page 102
Chapter 5 Using the RS–232 Ports
Forcing Local I/O (cont’d)
For example:
This example will force all outputs on. FF sets all bits in byte 3 (outputs 1 through 8) and 3F sets bits 0 through 5 of byte 4 (outputs 9 through 14). It is possible to have outputs forced on and off at the same time. A force off takes precedence over the force on. If multiple force commands are sent, the forced on or off outputs will be added to those already forced. If the BCC is not valid, the CVIM module will respond with a DLE NAK and the command will not be executed. If the BCC is valid, the CVIM module will respond with a DLE ACK. Then the CVIM module will validate the command structure. If the command is valid, the CVIM module will execute the command. If the command structure is invalid, the CVIM module will not execute the command or respond. Note: The outputs will remain in their forced states until a deactivate forces command is sent.
Loading Configurations
Use the load command to transfer configuration data between the CVIM module local storage area (EEPROM) and the external memory card. The RAM card slides into the slot on the front of the CVIM module. Use one of the following commands:
Transfers configuration from the EEPROM to the CVIM module internal RAM.
Transfers memory from RAM Card area 1 to the CVIM module internal RAM.
Transfers memory from RAM Card area 2 to the CVIM module internal RAM. 5–32
Page 103
Chapter 5 Using the RS-232 Ports
You cannot use these commands when the CVIM module is in the SETUP mode. If the BCC is not valid, the CVIM module will respond with a DLE NAK and the command will not be executed. If the BCC is valid, the CVIM module will respond with a DLE ACK. Then the CVIM module will validate the command structure. If the command is valid, the CVIM module will execute the command. If the command structure is invalid, the CVIM module will not execute the command or respond.
Lock Command
Use the lock command to disable the setup menu box so that the SETUP mode cannot be entered. This function can only be executed once per command. There is no object associated with this command. The command has the following structure:
If the BCC is not valid, the CVIM module will respond with a DLE NAK and the command will not be executed. If the BCC is valid, the CVIM module will respond with a DLE ACK. Then the CVIM module will validate the command structure. If the command is valid, the CVIM module will execute the command. If the command structure is invalid, the CVIM module will not execute the command or respond.
Read Output Status
Use the read command to read the status of the 14 discrete outputs on the local I/O board The command has the following structure:
This function can be executed more than once per command by specifying an n times value. The flags specify outputs 1 through 14:
Set individual bits to select outputs 1 through 14 5–33
Page 104
Chapter 5 Using the RS–232 Ports
Read Output Status (cont’d)
For Example:
This example will read the status of all fourteen outputs. FF sets all bits in byte 3 (outputs 1 though 8) and 3F sets bits 0 through 5 of byte 4 (outputs 9 through 14). One byte is returned to indicate the status of the output (1 = ON and 0 = OFF). The output bytes are transmitted in numerical order (output #1 then output #2, etc.). The amount of data returned depends upon the number of outputs being read. If the BCC is not valid, the CVIM module will respond with a DLE NAK and the command will not be executed. If the BCC is valid, the CVIM module will respond with a DLE ACK. Then the CVIM module will validate the command structure. If the command is valid, the CVIM module will execute the command and return the data. If the command structure is invalid, the CVIM module will not execute the command or respond.
Read Configuration Block Command
Use the read configuration command to read configuration data for the specified object. The command has the following structure:
06
07
Flags (17 bytes)
This function can only be executed once per command. The only valid object for this command are the configuration blocks. The flags indicate which of the 136 configuration blocks are going to be read. Set the bits in bytes 3 through 19 of the command to specify the block(s). Use the following chart to determine which bits to set:
5–34
Page 105
Chapter 5 Using the RS-232 Ports
Use the read configuration command to read configuration data for the specified object. The command has the following structure:
Read Configuration Block Command Bytes 3–19
8
32
56
80
7
31
55
79
104 103
128 127
6
30
54
78
Byte 3
Byte 4
Byte 5
Bits 7 – 0
Bits 7 – 0
Bits 7 – 0
5
4
3
2
1
16
15
14
13
12
11
10
9
24
23
22
21
20
19
18
17
43
42
41
67
66
65
91
90
89
116 115 114
113
Byte 6
Byte 7
Byte 8
Bits 7 – 0
Bits 7 – 0
Bits 7 – 0
29
28
27
26
25
40
39
38
37
36
35
34
33
48
47
46
45
44
Byte 9
Byte 10
Byte 11
Bits 7 – 0
Bits 7 – 0
Bits 7 – 0
53
52
51
50
49
64
63
62
61
60
59
58
57
72
71
70
69
68
Byte 12
Byte 13
Byte 14
Bits 7 – 0
Bits 7 – 0
Bits 7 – 0
77
76
75
74
73
88
87
86
85
84
83
82
81
96
95
94
93
92
Byte 15
Byte 16
Byte 17
Bits 7 – 0
Bits 7 – 0
Bits 7 – 0
102 101
100
99
98
97
112 111
110 109
108 107 106 105
Byte 18
Byte 19
Bits 7 – 0
Bits 7 – 0
126 125
124 123 122 121
136 135
134 133
120 119
118 117
132 131 130 129
Set individual bits to select blocks 1 through 136. 5–35
Page 106
Chapter 5 Using the RS–232 Ports
Read Configuration Block Command (cont’d)
For example: To read configuration blocks 49 and 50 you would send: 06(hex) for byte 1–
Indicates a read command.
07(hex) for byte 2–
Specifies the configuration blocks.
00(hex) for bytes 4 through 8. 03(hex) for byte 9–
Sets the first two bits of byte 9 to indicate blocks 49 and 50.
00(hex) for bytes 10 through 19. Refer to Appendix C for a description of the configuration blocks. You cannot use this command while the CVIM module is in the SETUP mode. Example:
This example reads configuration blocks 1 and 17. If the BCC is not valid, the CVIM module will respond with a DLE NAK and the command will not be executed. If the BCC is valid, the CVIM module will respond with a DLE ACK. Then the CVIM module will validate the command structure. If the command is valid, the CVIM module will execute the command and return the data. If the command structure is invalid, the CVIM module will not execute the command or respond.
5–36