The text of a manual · part 32 of 47
Bulletin 2803 VIM Vision Input Module User Manual: 14 - Integration with the PLC, pages 279 to 286
Pages 279 to 286 of 404, from Bulletin 2803 VIM Vision Input Module User Manual
The original document is the PDF (26 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.
For the Allen-Bradley 2803-VIM2
Page 279
Chapter
Bit Manipulation
14
Megration with the PLC 14-9
There are several ways to control the operation of the module using programming tools in the PLC controller. One way is to manipulate bits in the discrete bit communications set, and to control triggering through ladder logic programming. Many PLC controllers have a Bit Manipulation Menu which can be used to force the VIM2 module control bits - listed in Table 14-B as the output bits. This example uses a PLC 2/05 and T3 programming terminal. Other PLC controllers may be slightly different. To access the Bit Manipulation Menu, press SEARCH 53 on the T3 terminal. The Bit Manipulation Menu will be displayed as shown in Figure 14.3. The bits are listed in octal format. Figure 14.3 PLC Bit Manipulation
Menu Used to Force Control Bits \ f
BIT MANIPULATION
WORD ADDRESS:
0011
BIT NO : 17 16 15 14 13 12 11 10 07 06 05 04 03 02 01 00 STATUS : FORCE
0010000010011101
:
REMOTE PROG MODE
In this example the 0011 is used as the word address. The address you use will be determined by the location of the VIM2 module in your L/O chassis.
Page 280
Chapter 74-10
Bit Manipulation
Example 1:
14 integration with the PLC
Locking and Unlocking the VIM2 Module This bit is only effective if the PLC is the selected master host. Move the cursor to the Unlock bit (bit 10 in Table 14.B). Press “1” to unlock the module and enable light pen programming. The video monitor will display the title banner. Press “0” to lock the module and go to run mode. The title banner will disappear from the video monitor. The Unlock output bit is used to control access to the VIM2 configuration data. When the operator wants to enter the setup mode, the PLC controller must set this bit high. When the operator unlocks the VIM2 module with the light pen the set-up session is started. Note: As long as the Unlocfi bit is set low (01, the module’s configuration data cannot be modified.
Bit Manipulation
Example 2:
Rapid PLC System Triggering of the VIM2 Module A simple two-rung program can be used to rapidly trigger the VIM2 system inspection cycle (see Figure 14.4). This program is only effective if the VIM2 module is set so the PLC is the master host, and so the run mode trigger source is HOST TRIG (see Chapter 7). In this program, the Busy bit is used to drive the Trigger bit. This forms an oscillator which rapidly and continuously triggers the module. Figure 14.4 Rapid Firing Under PLC Control
VIM2 I
3
VIM2 Unlock 010
Err
I I
0
VIM2
VIbj2 &yw
14 t-
10
KY l----l/lI
12
1
END 01048
15
The oscillation is stopped when the module is unlocked by rung 1 due to an ACQ ERROR (brightness probe out-ofrange). The low range limit for the brightness probe should be set to a number greater than 10 to enable the shut-off (see Chapter 8). To test this while the program is running, disconnect the camera cable; the ACQ ERROR light comes on due to brightness out-of-range and inspections stop. To restart the program, force the Unlock bit back to zero.
Page 281
Chapter
Block Transfers
14
Megration with the PLC 74-77
The PLC can exchange data with VIM2 module using block transfer commands - block transfer “read,” and block transfer “write.” Block transfers are controlled from the PLC controller using ladder logic programming. There are four types of blocks which can be transferred - results, statistics, configuration, and command. A block of data can contain up to 64,16-bit words of data. You define the type of block, for the most part, by indicating the block length (number of words). Other requirements for the specifying different blocks are discussed individually for each block type in the following sections. Tables indicating block transfer data assignments are provided in Appendices B, C, and D for configuration, results, and statistics data. The data in data blocks may be assigned in either bit or word increments. Some information, such as an accept/reject decision, requires only one bit, while other information, such as a measured value for a tool, requires a byte of information (8 bits) or a full word.
Configuration
Blocks
Configuration blocks contain information regarding the VIM2 module configuration. This information can be read from the VIM2 module, or downloaded to the VIM2 module (see Appendix B for the contents of the configuration blocks). The VIM2 module can store two configurations in its EEPROM memory, and another configuration (the working configuration) in its volatile RAM memory. You select which configuration you read or write through the use of discrete bits. There are four blocks per configuration; you select which block of a configuration you are writing or reading by specifying the block length (that is, number of words - 30,62,63, or 64): Configuration Block One - 30 Words - Trigger status - Strobe status - Run-time image freeze status - Probe position and acceptance range data - Window configuration data for windows l-4 Configuration Block Two - 62 Words - X and Y Float line gage configuration data - Configuration data for line gages l-10 Configuration Block Three - 63 Words - Configuration data for line gages 11-22 Configuration Block Four- 64 Words - Configuration data for math tools 1-12
Page 282
Chapter 14- 12
Configuration
Blocks
(con tin ued)
14
Integration with the PlC
Reading Configuration Data To upload configuration data from the VIM2 module to the PLC, use a block transfer “read” command. You can upload any one or all of the configuration blocks, as required. You can only read one block at a time. You cannot read configuration blocks while the VIM2 module is in setup mode. If the PLC is master host, it can read configuration data during either stand by (unlocked, and not in setup mode) or run mode. If the PLC is not the master host, it can read configuration data only in standby mode. You can read configuration data from either of the VIM2 module EEPROM configurations. In doing so, for each configuration block read, your program would include these steps: 1. If you are attempting to upload a configuration while the VIM2 module is running in the learn mode, clear the Select Block Type discrete bit to specify configuration blocks (and not statistics). 2. Before sending the block transfer command, set the Configuration Storage discrete bit to “1” to select EEPROM configuration (setting this bit to “0” to select RAM is not a valid option for block transfer reads). 3. Set or clear the Select Configuration EEPROM configuration 1 or 2.
discrete bit to specify
4. Select the configuration block you are reading by block length (number of words - 30,62,63, or 64). 5. Monitor the Busy discrete bit, and wait until Busy discrete bit is clear, indicating the VIM2 module status is not busy. 6. Monitor the Config Busy discrete bit, and wait until Config Busy discrete bit is clear. 7. Send the block transfer read command. 8. Monitor the Config Busy bit. When it is clear, the block transfer is complete.
Page 283
Chapter
14 integration with the PLC 74-73
Writing Configuration Data To download configuration data from the PLC to the VIM2 module, use a block transfer “write” command. You can download any one or all of the configuration blocks, as required. You can only write one block at a time. Writing configuration block is allowed only while the VIM2 module is in stand by mode, and if the PLC is the selected master host. You can either write only to the VIM2 module RAM configuration, or you can write to EEPROM configuration 1 or 2 in addition to writing to the RAM configuration. In doing so, for each configuration block write, your program must: 1. Check the Unlock discrete bit; set if it is not set. 2. Before sending the block transfer command, set or clear the Configuration Storage discrete bit to select either RAM only or RAM and also EEPROM configuration. Note: Configuration data stored into EEPROM takes about 5 seconds. When configuration data is stored in RAM only there is no such time requirement. 3. If you select EEPROM in step 2, also set or clear the Select Configuration discrete bit to specify EEPROM 1 or 2. 4. Select the configuration block you are writing by block length (number of words - 30,62,63, or 64). 5. Clear the Lust Block discrete bit if you are not sending the last block. Otherwise, set the Lust Block discrete bit. 6. Monitor the Busy and Configuration Busy bit status; wait until these bits are clear to send the block transfer write command. 7. Send the block transfer write command. 8. Monitor the Config Busy bit. When it is clear, the block transfer is complete.
Page 284
Chapter 74- 74
Results
B/o&
14
Integration with the PLC
The results blocks provide specific results data for each vision tool (see Appendix C for a complete listing of the contents of the results blocks). The results blocks can only be read from the VIM2 module; you cannot write results blocks to the VIM2 module. There are two results blocks - Results Block l(59 words, all results except math tools) and Results Block 2 (13 words, math tools only). The PLC can read results only while the VIM2 module is in run mode. Block Length You select which results block you are reading by specifying the block length (that is, number of words). You specify 13 to select Results Block Two. To select Results Block One, specify any number of words from 1 to 59 (except 13 or 30).* The PLC will read that amount of consecutive words in Results Block One, starting with the first word. *Note: If you specify 30, the PLC reads the configuration block of that length; if you specify 13, the PLC reads Results Block Two (only if a math tool is enabled; otherwise the PLC reads the first 13 words of Result Block One). You cannot read a partial portion of Results Block Two. The results are provided in either binary, or binary-coded decimal (selectable through the BinarylBCD Results bit). Results Block One - 1-59 Words (words 1-4, discrete results): - The brightness probe (in range/out of range) - Windows 1 through 4 (accept/reject) - X and Y Float line gages (in range/out of range) Line gages 1 through 22 (accept/reject) i words 6-58, measured values): - Brightness probe luminance level - Pixel counts for windows 1 through 4 - Upper and lower function results, X and Y float gages - Upper and lower function results, line gages 1 through 22 Results Block Two - 13 Words (word 1, discrete results): - Math tool (1-12) results (accept/reject) (words 2-13, actual values): - Math tool (1-12) results values Reading Results Data To upload results data from the VIM2 module to the PLC, use a block transfer “read” command. You can only read one block or partial block at a time.
Page 285
Chapter rResultsBlocks
14
Integration with the PLC 14-75
In reading each results block, your program must:
(continued)
1. Before sending the block transfer command, if you are attempting to upload results while the VIM2 module is operating in the “learn” mode, clear the Select Block Type discrete bit to specify results blocks (and not statistics). 2. Set or clear the BinarytBCD binary or BCD results.
Results discrete bit to select
3. Select the block you are reading by block length. 4. Monitor the Busy discrete bit status; when it changes from 1 to 0, send the block transfer read command. 5. Monitor the Config Busy bit. When it is clear, the block transfer is complete.
S ti3 tistics
Blocks
The statistics blocks provide data for each vision tool collected while the VIM2 module is running in the “learn” mode. The statistics blocks can be only be read from the VIM2 module, and cannot be written to the VIM2 module (see Appendix D for a complete listing of the contents of the statistics blocks). The PLC can read statistics only while the VIM2 module is running in learn mode. There are four statistics blocks; you select which statistics block you are reading by specifying the block length (that is, number of words - 55,12,62, or 60): Statistics - Number - Number - Number - Number - Number
Block One - 55 Words of triggers of triggers failed of window failures, windows l-4 of X and Y float gage failures, upper/lower of line gage failures, l-22, upper/lower
Statistics Block Two - 12 Words - Number of math tool failures, l- 12 Statistics Block Three - 62 Words (Statistics - minimum, maximum, average) - Brightness Probe - Windows 1-4 - X and Y float gages, upper/lower - Line gages 1-14, upper/lower Statistics Block Four - 60 Words (Statistics - minimum, maximum, average) - Line gages 15-22, upper/lower - Math tools 1-12
Page 286
Chapter 14-76
Statistics Blocks (continued)
14
Integration with the PLC
Reading Statistics Data To upload statistics data from the VIM2 module to the PLC, use a block transfer “read” command. You can upload any one or all of the statistics blocks, as required. You can only read one block at a time. You can only read statistics while the VIM2 module is running in the “learn” mode. The statistics are provided in binary format only. For each statistics block read, your program must: 1. Before sending the block transfer command, set the Select Bloctz Type discrete bit to specify statistics blocks (and not configuration or results). 2. Select the statistics block you are reading by block length (number of words - 55,12,62, or 60). 3. Monitor the Busy discrete bit status; wait until the bit is clear, indicating the VIM2 module is not busy. 4. Send the block transfer read command. 5. Monitor the Config Busy bit. When it is clear, the block transfer is complete.