1 configuring the module, 2 reading the data – Rockwell Automation 57C428 Toledo Scale Interface Module User Manual

Page 24

Advertising
background image

4Ć8

4.3.1

Configuring the Module

The module must be configured whenever you turn on power to the

system or change the baud rate of the serial interface. If the module

has not been configured, it will display the letter C" on its LED. The

following is an example of the BASIC statements required in an

application task to configure the module.

400

COMMON LINK_STATUS@

\!Link configuration status

410

COMMON LINK_CONF%

\!Link configuration request

420

COMMON BAUD_RATE%

\!Baud rate

430

COMMON RQST_STATUS%

\!Message request

440

COMMON MSG_NO%

\!Message number

450

COMMON STATUS_A%

\!Status byte A

480

COMMON INDICATED_WT!

\!Indicated weight

490

COMMON TARE_WEIGHT!

\!Tare weight

600

LOCAL

OLD_MSG_NO%

\!Old data check

610

LOCAL

WEIGHT

\!Weight in eng units

620

LOCAL

TARE\!Tare weight in eng units

630

LOCAL

EXPONENT

\!Power of ten scaling

1000

REM

1010

REM Initialize Interface Ć Execute this section only 1 time

1020

REM

1030

BAUD_RATE% = 9600

1040

LINK_CONF% = 00FFH

\!Request link configuration

1050

DELAY 1 TICK

\!Wait for link config.

1060

IF NOT LINK_STATUS@ THEN 1050

1070

OLD_MSG_NO% = -1

\!For old" data check

4.3.2

Reading the Data

The following is an example of the BASIC statements required to read

the data from the module:

2000

RQST_STATUS% = 1

\! Set request flag for data

2010

DELAY 1 TICK

2020

IF RQST_STATUS% = 1 THEN 2010

\! Check for returned status

2030

IF RQST_STATUS% < 0 THEN 3000

\! Branch if error

2047

REM

2048

REM Valid data, process weight data

2049

REM

2050

IF MSG_NO% = OLD_MSG_NO% THEN 2110

2055

REM

\! If old data, skip conversion

2060

OLD_MSG_NO% = MSG_NO%

\! Update old message number

2070

EXPONENT=10.**(2-(STATUS_A% AND 07H))

2075

REM

\! Get power of 10

2080

IF EXPONENT > 1. THEN EXPONENT = 1.0

2085

REM

\! If x1 or more, no scaling req'd

2090

WEIGHT = INDICATED_WT! * EXPONENT

2095

REM

\! Convert weight data to REAL

2100

TARE = TARE_WEIGHT! * EXPONENT

2105

REM

\! & account for decimal point

2110

!

2500

!

3000

!ąError status returned

3100

!

3200

!ąDecode error status

3300

END

Advertising