beautypg.com

Explanation of ascii programming example – Rockwell Automation 5370 CVIM Communications Manual User Manual

Page 93

background image

Chapter 5

Using the RS-232 Ports

5–23

The following sample program was written on an Allen-Bradley 1784-T50B
terminal (IBM AT compatible) using GW basic. This program obtains
discrete results from the CVIM module. A program user is prompted to
select either toolset 1 or toolset 2. The program will then:

Trigger an inspection.

Detect when new data is available.

Read all pass/fail/warning data for the selected toolset.

Display a screen message if any of the first four windows fail.

Prompt the user once again for a toolset number.

A basic outline of the program is as follows:

Lines 10 to 99

Initialize program variables, configure the RS–232 port
for 8 bit transmissions, select no parity, select 9600
Baud, and initialize the display monitor.

Lines 100 to 130

Prompt the operator to select a trigger for toolset 1 or
toolset 2.

Subroutine 2000

Reads results to find the current number of total triggers.

Subroutine 1000

Triggers the CVIM module inspection of the selected
toolset.

Line 200

Causes a continuous read of CVIM module results until
new results are detected. New results are detected by an
incrementing of the “total trigger” data.

Subroutine 2500

Converts the CVIM module results from hexadecimal to
integer.

Lines 240 to 270

Analyze the discrete fail bits for windows 1 through 4
and display a message if a failure is detected.

Line 400

Sends the program to input line 100.

The program manipulates the returned data as follows:

Explanation of ASCII
Programming Example