Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual · part 34 of 47

Bulletin 2803 VIM Vision Input Module User Manual: 15 - Using the RS-485 Port, pages 295 to 303

Pages 295 to 303 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 295

Chapter

Chapter Objectives

RS-485 Communications

15

Using the

RS-485

Port

In this chapter we describe how to: l

Configure the VIM2 module for serial communication.

l

Use ASCII or DFl protocol commands to perform functions including uploading or downloading configurations, reading results or statistics data, and locking/unlocking the VIM2 module.

Using the RS-485 port you can link computers which have an RS-485 port to the VIM2 module. You can also link these additional devices, through the use of an RS-232/RS-485 converter, to the VIM2 module’s RS-485 port: l

Computers with RS-232 ports l

Operator Interfaces such as Allen-Bradley Industrial Terminals and Computers with serial ports.

l

I/O modules such as the BASIC module (Catalog No. 1771-DB) or ASCII module (Catalog No. 1771-DA).

The RS-485 port on the VIM2 module is designed for halfduplex, point-to-point communication only. Note: To communicate with the VIM2 module RS-485 port, you must also supply the communication driver for your host device. Contact your local Allen-Bradley representative for more information on RS-232/RS-485 converters and/or communication drivers.

ASCII and DFI Protocols

There are two protocol options when you use the RS-485 communications port, ASCII and DFl. This chapter describes both of these options. First we describe the ASCII protocol and then the DFl protocol.

Command Availability

The availability of each serial command depends on the current mode of the VIM2 module (setup, standby, or run), and upon whether or not the serial host is selected as the master host. The stipulations for mode and host status are listed in the descriptions for each command.

Page 296

Chapter

15

Using the RS-485 Port

IS-2

What Functions Can Be Performed Over The RS-485 Interface?

1///W2 Moth/e

Configuration Instructions Your Action Pick the Environment icon on the Setup m.enu to access the Environment menu.

A host device can perform the following the RS-485 port:

functions through l

Obtain VIM2 module results information.

l

Obtain VIM2 module statistics information.

l

Upload or download VIM2 module configurations.

l

Transfer configurations between the VIM2 module’s RAM configuration and two EEPROM configurations.

l

Change run mode display.

l

Trigger an inspection.

l

Lock or unlock the VIM2 module to control access to the setup mode.

If you are using the RS-485 port, you must configure the VIM2 module, using the light pen/monitor interface, for serial communications. Begin by enabling and configuring the serial communications port: Comments If the Main menu is displayed, first access the Setup menu by picking the Setup icon (the “open padlock”). Then, with the Setup menu displayed, pick the Environment icon.

Setup Menu

Environment

Serial Enable Icon fl w

Menu

Baud Rate Icon

Pick the Serial Enable icon to select ASCII or I)Fl protocol. Pick the Baud Rate icon as necessary to set the baud rate for communication.

Picking this icon repeatedly cycles through the baud rate options - 1200,2400,4800, or 9600.

Page 297

Chapter. 15

Using the RS-485 Port 75-3

VIM2 Configuration instructions

(continued)

Note: When you select RS-485 communications, format is fixed as follows: l

8 Data Bits l

1 StopBit l

No Parity the data

Next, select the master host, or select no master host, according to whether a PLC, or a serial device, will act as the master host, or if no device will be a master host. The master host is exclusively permitted to perform certain functions, such as downloading configurations or triggering inspections. A subset of the master host functions can be performed by a PLC o.r serial device which is not the master host, such as the collection of configuration or results data (Note: The specific host and mode stipulations which apply when issuing a command from a serial host are included in this chapter, in the description for each command). Your Action

Comments

Pi& the Host! Standalone icon as necessary to select the appiropriate mode.

Picking this icon selects the master host (or selects no muster host). Note: The Serial Host icon is not available unless you first enable the RS-485 port using the Serial Enable icon (described on the previous page).

Host / Standalone Icon

PlC is master host nl

%

No master host

Ei

+

RS-485 device is master host

Pick the Trigger Source icon as necessary to select the appropriate mode.

Picking the Trigger Source icon toggles the icon between Host Trigger and Swingarm Trigger. Note: Ifthe Host Trigger icon is selected, a master host must be selected (PLC or serial), since only a master host can issue a trigger.

Trigger Source Icon

@q-L

Swingarm Trigger

Page 298

Chapter

15

Using the RS-485 Port

15-4

VIM2 Powerup Sequence with Serial Device as Master Host

When the VIM2 module is powered up, regardless of the master host selection (PLC, serial, or no master host) it first conducts a number of self-diagnostic tests. The VIM2 module also checks the two configurations stored in the EEPROM; if both are valid, the selected Starting Configuration is downloaded from EEPROM to RAM to become the working configuration. If the serial line has been selected as the master host, the VIM2 module waits for five seconds for a command from the serial host after the diagnostics are complete. If a command from the serial host is not received within five seconds, the VIM2 will automatically be “unlocked,” and the VIM2 module will go to standby* mode. The selection of serial line as the master host is maintained by the VIM2 module. If a command from the serial host is received within five seconds, the VIM2 module will be locked and will go to run mode (unless the command is the Unlock command, in which case the VIM2 module goes to standby* mode). *Note: Standby mode is an interim mode of the VIM2 module which occurs upon leaving run mode, and before entering setup mode. When the VIM2 module is in standby mode, the title banner is displayed on the monitor. The VIM2 module enters standby mode when:

Serial Line “Wake- up” a

The VIM2 module, in run mode, is unlocked by the master host.

l

The VIM2 module is in setup mode, a master host is present, the module is locked, and you exit setup mode by picking the Run icon.

l

The VIM2 module is in run mode and operating as a standalone unit, and you pick the monitor screen once with the light pen.

The VIM2 module does not continually monitor the serial line for messages; instead, it waits until an incoming signal is received, and then “wakes up” and begins to receive the incoming signal. So part of the initial incoming command is lost. Thus, each time a command is sent, the VIM2 module will respond to the initial command as though it is an invalid command - in DFl protocol a NAK is issued; in ASCII, the ? character is issued. In order to accomodate the necessity for serial line wake-up, the serial host must respond to the initial NAK (DFl) or ? (ASCII) by repeating the original command.

Page 299

Chapter 15

Using the RS-485 Port 15-5

Serial Line Error Tracking

The VIM2 module maintains three counters for the purpose of tracking and handling communication errors. You can access the counter data only by sending the Serial Line Diagnosis command. You set counter maximums using the SeriaE Line Initialization command. The purpose of these counters and their maximum settings is discussed below. The first counter tracks the number ofconsecutive erroneous messages, and is incremented each time a message exchange is aborted (for example, when the limit of NAKs, or negative acknowlegements, is surpassed). The consecutive erroneous messages counter is reset to zero when: a successful message exchange between the serial host and the VIM2 module is achieved; when the serial line driver is initialized (refer to the Serial Line Initialization command), when a user-defined maximum number of consecutive erroneous messages has been reached (refer to the Serial Line Initialization command), or when a userdefined maximum number of inspections has been completed since the last reset. If the maximum number of consecutive erroneous messages is reached, a condition called serial line fai2ure occurs. When a serial line failure occurs, a second counter -which tracks the number of serial line failures -is incremented. Other consequences of serial line failure depend on whether or not the serial line host is the master host. If the serial line host is not the master host, and a serial line failure occurs, the VIM2 module continues operating in run mode, but the serial line communication is shut down, and this icon - appears on the monitor (unless the image is “frozen,” which occurs if the Freeze on Reject mode is selected and a reject occurs). While the serial line is shut down, a third counter which tracks the number of inspections since the last serial line reset - is incremented. The serial line is reenabled when the number of inspections since the last serial line reset counter reaches a user-defined maximum (refer to the Serial Line Initialization command). If the serial line host is the master host, and a serial line failure occurs, serial line communication remains enabled. However, this icon appears on the monitor - and theVIM module halts the inspection process, until a valid message is received from the serial host.

Page 300

Chapter 15.

Using the RS-485 Port

75-6

ASCII hOtOCO/

AK//

Protocol’ Conventions

This section describes the use of ASCII protocol for communication with the VIM2 module, including descriptions of the ASCII commands.

In describing the ASCII protocol we use the following conventions: l

All ASCII commands begin with the ” > ” character.

l

ASCII commands are shown in bold characters:

> RCn,CBf l

Non-printable

[CR] ASCII characters are shown as follows:

[CR] = Carriage Return [LF] = Line Feed = Space l

Unless _ is specified, there are no spaces between characters.

l

ASCII commands contain only these ASCII characters: - Digits O-9 -Letters l

A-Z (upper case), *, - ,

(space), and , (comma)

The X is the repeat count, an optional parameter for some commands which indicates the number of times the VIM2 module will repeat the given command. For example:

> RRx,RD

[CR]

The range for this parameter is between 0 and 255. If you do not include the repeat count, the value of 1 is assumed. If you use the repeat count value of 0 (zero), the command will be executed indefinitely (until another command is received). Note: A repeat count of 0 is treated as 1 for Echo commands. Note also that when a repeat count is used with any Read type command (not including Read Configuration), the VIM2 module will send the data after each inspection, until the number of repeats is executed, or until another Read type command (including Read Configuration) is received; the newly received command will then be executed. Commands such as Trigger, or Change Display Mode received before the repeats are completed will not cancel the remainder of the command repeats, nor will going to setup mode then returning to run mode.

Page 301

Chapter 15

Using the RS-485 Port 15-7

AK//

Protocol Con wentions (continued)

l

The n qualifier is included in some commands to designate a specific configuration.

l

The f flag parameter is included in some commands to select specific blocks, bits, or images. For example:

>RCn,CBf [CR] Replace n in the above command with a digit (O-2) to specify RAM, EEPROM 1 or EEPROM 2. Replace f in the above command with a digit to specify a single block. Replace f with “*” to specify all blocks. Replace f with a range (f 1 - f2) to specify a group of blocks as shown in the example below:

> RCl ,CBl-3

ASC// Data Con version

[CR]

Some ASCII commands involve the exchange of data between the VIM2 module and the host. This data is defined in the command or response format descriptions for each command, where applicable. Note that, when ASCII protocol is used, data from the VIM2 module is transmitted as hexadecimally-encoded ASCII characters; these ASCII characters must be interpreted as hexadecimal digits for decoding by the user. For example, a VIM2 module response to this Read Outputs command:

>RO,l-4

[CR] could be the following hexadecimal values:

30 30 20 30 30 20 30 30 20 30 3113 These values represent the ASCII characters 0 0 space

0 0 space

0 0 space

0 1 carriage return.

The above ASCII response would be interpreted, then, as hexadecimal 00 00 00 01 and be used as the response byte data by the user. Note: Examples of response data are included in the command descriptions in this chapter. These data examples depict hexadecimal values - the hexadecimal values obtained by converting the hexadecimally-encoded ASCII response to hexadecimal data bytes, as described above.

Page 302

Chapter

15

Using the RS-485 Port

15-8

Using ASCII Protocol

After you have made the equipment connections and configured the VIM2 module for RS-485 communications with ASCII as the selected protocol, all ASCII strings issued by the host will be interpreted as commands. The VIM2 module will validate the command. If the command is valid the VIM2 module will reply:

If the command is not valid the VIM2 module will respond: ? [CR] [LFI The VIM2 module will process all valid commands and discard any invalid commands. Data may or may not be returned with a command depending upon the type of command that was sent. Refer to Appendix G for an ASCII conversion chart. Note: A simple way to test the RS-485 link is to send the VIM2 module a [CR]. If you have the port properly connected and have the VIM2 module configured for RS-485 with ASCII as the selected protocol, you will receive this response. - ? [CR][LF]. If you receive no response, check your connections and VIM2 module configuration. The ASCII commands are discussed beginning page* on the next

Page 303

Chapter 7 5

Using the RS-485 Port 15-9

Serial Line Initialization

Use this command to set two parameters for the serial line error tracking (listed as nl and n2 for this command, and dl and d2 in the response to the Serial Line Diagnostics command). Refer also to the Serial Line Error Tracking section in this chapter for more information. This command has the following structure:

>X I,nl ,n2 [CR] nl =

Decimal value for maximum number of erroneous messages h$/;;lt = 100). Range is O- n2=

Decimal value for maximum number of inspections between resets of consecutive erroneous error counter, or between reenabling of communications (d&k&t = 500). Range is O-

Sending this command also resets the VIM2 module’s counter for each parameter (refer to d3 and d4 in the response to the Serial Line Diagnostics command on the next page).

Set the nl value according to the selected baud rate, and the maximum allowable error delay. Set the n2 value according to the average inspection rate and the required delay before trying to reenable communications.

Host/Mode Stipulations: Valid for either master host or non-master host. Valid in all modes.