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

The text of a manual · part 10 of 25

Bulletin 5370 CVIM Configurable Vision Input Module Communications Manual: 5 - Using the RS-232 Ports, pages 71 to 79

Pages 71 to 79 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 71

Chapter

A–B

5

Using the RS-232 Ports Chapter Objectives

In this chapter we describe how to:

• Connect RS–232 device(s) to the CVIM module. • Obtain results data using ASCII or DF1 protocols. • Upload and download configurations. In addition, this chapter provides example programs.

RS–232 Communications

Using the RS–232 interface you can link a variety of devices to the CVIM module:

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

• I/O modules such as the Basic Module (Catalog No. 1771–DB) or ASCII module (Catalog No. 1771–DA).

• Allen-Bradley DATAMYTE and Dataliner devices (requires USER-PAK Software, Catalog No. 5370-UPK). All commands are simple ASCII and/or Hexadecimal strings. Refer to Appendix E for an ASCII conversion chart. These commands can be generated using a variety of programming languages (C, Fortran, BASIC). This chapter provides a sample ASCII program (written in BASIC) and a sample DF1 program (written in C).

ASCII and DF1 Protocols

There are two protocol options when you select an RS–232 communications port (A or B):

• ASCII • DF1 This chapter describes both of these options. First we describe the ASCII protocol (page 5–5) and then the DF1 protocol (page 5–29).

5–1

Page 72

Chapter 5 Using the RS–232 Ports

Equipment Connections

As shown in Figure 5.1, the RS–232 ports (A & B) are located on the I/O Interface Boxes (Catalog No. 2801–N21, –N27). The I/O Interface Box is connected to the MODULE I/O port on the front of the CVIM module. You will need a communications cable to link your host device to the CVIM module. Refer to Figure 5.2 for diagrams of host to I/O Interface Box cabling. Figure 5.1 RS–232 Equipment Connections.

However, if you are using the 2801-N27 I/O Interface Box with the CVIM Module Series A hardware only RS-232 port A is active.

1771

A

1771

5–2

Page 73

Chapter 5 Using the RS-232 Ports

Figure 5.2 RS–232 Cabling.

DB25 Female (IBM PC/XT, VT–220, etc.) View from the back of the connector

DB9 Female (IBM PC/AT) View from the back

DB9 Male (CVIM) View from the back

DB9 Male (CVIM) View from the back

Note: Connections for Catalog No. 2801–N27 I/O Interface Box RS–232 Port A with CVIM Series B Module is shown in this illustration. Refer to Chapter 3 for other RS–232 Connections.

What Functions can be performed over the RS–232 Interfaces?

A host device (SYS or CFG) can request or manipulate the following data through the RS-232 ports (A&B): Obtain CVIM module results information. Refer to Appendix A, B and C (CFG or SYS host). Upload or download CVIM module configurations for inspections. Refer to Appendix D (CFG host). Issue Read/Write commands between the following CVIM module memory locations (CFG host): CVIM module Random Access Memory (RAM) and CVIM module Electrically Erasable Programmable Read Only Memory (EEPROM). CVIM module RAM and RAM card. The RAM card slides into a slot on front of the CVIM module. Change run-time display (SYS host). Enable/Disable local I/O board (SYS host). Force local I/O On or Off (SYS host). 5–3

Page 74

Chapter 5 Using the RS–232 Ports

CVIM Module Configuration Instructions

If you are using the RS–232 ports (A or B), you must configure the CVIM module as follows: Set the Baud Rate(s) 1 1 1 1 1

Select the setup menu <Setup>. Select the environment menu <Environ>. Select the I/O menu <I/O>. Select RS–232 communications <RS–232 A> or <RS–232 B). Select the Baud rate which matches your host device; from 300 to 19.2K Baud. Note: When you select RS–232 communications, the data format is fixed as follows:

• 8 Data Bits • 1 Stop Bit No Parity Select the CFG and SYS Hosts Note: The following steps are not necessary if you are just reading results data. 1 1 1 1 1

Select the setup menu <Setup>. Select the environment menu <Environ> Select the system menu <System> Select a host menu <CFG Host> or <SYS Host>. Select RS–232 port for host communications <RS–232A> or <RS–232B>.

Select the Protocol 1 Select the I/O menu <I/O>. 1 Select RS–232 communications <RS–232 A> or <RS–232 B>. 1 Select either <ASCII> or <DF1>. Select the CVIM module Trigger Source 1 Select the toolset menu <Toolset> 1 Select the trigger source menu for the appropriate toolset <Trigger Source>. 1 Select either <I/O>, <Hosted>, or <Auto Trigger> trigger source. Select hosted trigger if you are using the RS–232 trigger commands. Use I/O trigger if you are using the discrete I/O inputs as a trigger. Note: The next section of this chapter describes ASCII protocol followed by a description of DF1 protocol. 5–4

Page 75

Chapter 5 Using the RS-232 Ports

ASCII Protocol

In describing the ASCII Protocol we use the following conventions: Non–printable ASCII control characters are represented as follows: [CR] = Carriage Return [LF] = Line Feed ___ = Space ASCII commands are provided in large bold characters:

>RR, RB,3 [CR] Unless _ is specified, there are no spaces between characters. Some commands have fields which can contain variable data such as number of times a command is repeated, block numbers, data, etc. These fields are shown using lowercase lettering:

>W,CBn,d [CR] In this example, the letters n and d indicate data which is variable. The other characters indicate fixed data.

Overview

After you have made the equipment connections and configured the CVIM module for RS–232 communications, all ASCII strings generated by the host will be interpreted as commands. The CVIM module will then validate the command structure. If the command has an acceptable structure the CVIM module will reply: [CR][LF]. Refer to Appendix E for an ASCII conversion chart. If the command has an incorrect structure the CVIM module will respond: ? [CR] [LF]. The CVIM module will process all validated 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. Note: A simple way to test the RS–232 links is to send the CVIM module a [CR]. If you have the port properly connected and the CVIM module configured for RS-232, the CVIM module should send a ? [CR][LF] in response. If no response is provided, check your connections and CVIM module configuration. Note: Some commands cause a continuous flow of returned data. To stop the flow of data you should send another command (valid or invalid). We recommend using a [CR] to stop the transmission of data.

ASCII Character Set

The CVIM module recognizes the following ASCII characters; all other characters are ignored.

• Upper and lowercase letters A through Z (case is insignificant). 5–5

Page 76

Chapter 5 Using the RS–232 Ports

ASCII Character Set (cont’d)

• Symbols: > (greater than) * (star) , (comma) – (dash) (space) represented by __

• Nonprintable control characters: CR (carriage return) LF (line feed) XON XOFF

• Numbers 0 through 9

Command Structure

Each command the host device sends to the CVIM module consists of an ASCII string of characters beginning with > and terminated with a [CR]. Characters in between are separated into fields by commas. The following shows the structure of a typical command: Header

Field 1

Field 2

Field 3

Trailer

> OPERATION (X times), (OBJECT), (DATA) CR ( ) Indicates Optional Information

Note: There are two modifiers that may appear in the command line: x times modifier – This modifier is only used with certain commands to indicate the number of times the command is to be performed. The range for this value is between 0 and 255. A value of 0 indicates infinity. If you do not specify a value, a default of 1 is provided. Toolset modifier – This modifier specifies either toolset 1 or toolset 2. TS1 and TS2 are the two valid entries. This modifier is only used to specify toolset dependent objects. There are three types of fields: Operation Field– This field contains commands directed to the CVIM module. There can only be one operation per command line. Some operations don’t require any additional fields while others may require an object field, data field, or both. Note that some commands cannot be used while the CVIM module is in SETUP mode. If an operation cannot be performed because either the wrong host port has been selected or the CVIM module is in the SETUP mode, the CVIM module will respond to each command with ?[CR][LF]. 5–6

Page 77

Chapter 5 Using the RS-232 Ports

Object Field– Object fields specify data that configures the operation of the CVIM module. There are two types of objects: 1) Toolset independent objects which do not require a toolset identifying number. 2) Toolset dependent objects which need a toolset identifying number. The object field contains alphanumeric characters which specify one or more objects. Individual objects are specified by name. Multiple objects (of the same type) are specified with an “*” for all objects of this type or by using a “–” to indicate a range of objects. In the description of each command we specify the objects that can be entered into a command.

• Data Field– Contains data.

XON/XOFF Flow Control

XON/XOFF characters control the flow of data between the CVIM module and the host. The XON character is transmitted by the receiving device to indicate that data can be transmitted. The XOFF character is transmitted when the receiving device cannot accept any more data (data buffers are filled). When the receiving device can accept more data, it sends another XON character. The following characters are used: XON =^Q (CTRL Q) XOFF =^S (CTRL S).

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:

>DF [CR] After executing the command, the CVIM module will return: [CR][LF]. No data is returned If you do not have the proper command structure, the CVIM module will return: ?(CR][LF].

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:

>Ex,d [CR] Where x specifies the number of times the CVIM module will echo the data field back to the host device. If you fail to specify an x value, a default value 5–7

Page 78

Chapter 5 Using the RS–232 Ports

Echoing Data (cont’d)

of 1 is assumed. d is the data that is to be echoed. The command is valid at any time. For example:

>E2,HELLO [CR] This example will cause the CVIM module to return the string:

[CR] [LF] HELLO [CR] [LF] HELLO [CR] [LF] If you do not have the proper command structure the CVIM module will return:

?[CR] [LF]

Enable/Disable Outputs

Use this command to enable or disable outputs on the Local I/O Board (Catalog No. 1771–JMB). Use the following commands:

> EO [CR]

This command enables the outputs.

> DO [CR]

This command disables the outputs.

After executing the command, the CVIM module will return: [CR] [LF]. No data is returned. If you do not have the proper command structure, the CVIM module will return: ?[CR][LF].

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. Use one of the following commands:

> F,On,1 [CR]

Forces output(s) on.

> F,On,0 [CR]

Forces output(s) off.

Where n is the output being forced on or off, outputs 1 through 14. n = 1 to 14 X–Y *

(individual outputs, can be non-consecutive) (range of outputs X through Y) (all of the outputs)

For example:

> F,O*,1 [CR] 5–8

This example will force all outputs on.

Page 79

Chapter 5 Using the RS-232 Ports

Another example:

> F,O3–9,0 [CR]

This example forces outputs 3 through 9 off.

For example:

> F,O4–6,1 [CR]

Forces outputs 4–6 on.

> F,O8,1 [CR]

Forces output 8 on.

>F,O1–4,0 [CR]

Forces outputs 1–4 off.

Notice that output #4 was forced on and then forced off. The force off takes precedence over the force on. After executing a command, the CVIM module will return: [CR][LF]. If you do not have the proper command structure the CVIM module will return: ?[CR][LF]. 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 to the CVIM module’s RAM. Use one of the following commands:

> LO [CR]

Transfers configuration from the EEPROM to the CVIM module internal RAM.

> LO,CC,1 [CR]

Transfers memory from the RAM Card area 1 memory to the CVIM module internal RAM.

> LO,CC,2 [CR]

Transfers memory from the RAM Card area 2 memory to the CVIM module internal RAM.

This function can only be executed once per command. You cannot use this command when the CVIM module is in the SETUP mode. After executing a command, the CVIM module will return: [CR][LF]. No data is returned by the command. If you do not have the proper command structure or the CVIM module is in the SETUP mode, the CVIM module will return: ?[CR][LF].

Lock Command

Use the lock command to disable the setup menu box so that the SETUP mode cannot be entered using the light pen. This function can only be executed once per command. There is no object associated with this command. The command has the following structure:

>L[CR] After executing a command, the CVIM module will return: [CR][LF]. No data is returned by the command. If you do not have the proper command 5–9