58
S4500 PLC User’s Reference Manual Revised: September 28, 2007 Copyright © 2007 Micro-Comm, Inc.

S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

  • Upload
    hatram

  • View
    219

  • Download
    1

Embed Size (px)

Citation preview

Page 1: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

S4500 PLC

User’s Reference Manual

Revised: September 28, 2007

Copyright © 2007 Micro-Comm, Inc.

Page 2: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

Table of Contents

Introduction ....................................................................................................................................................3Specifications and Sales Information .............................................................................................................4Board Connections and Jumpers ....................................................................................................................5Sample Wiring Diagram ................................................................................................................................6Expansion I/O Module Setup ....................................................................................................................... 11Display Module Operation ...........................................................................................................................12Micro-Comm RTU32 Protocol I/O Layout ..................................................................................................13Allen-Bradley DF1 and Modbus Protocol Support .....................................................................................14S4500 Configuration ....................................................................................................................................15

Program Installation ...............................................................................................................................15RTU Information Screen ........................................................................................................................16Configuration Parameters .......................................................................................................................17Analog Labels and Scaling Factors ........................................................................................................20Output Timer Labels ..............................................................................................................................21Stop/Start Setpoint Labels ......................................................................................................................22X Variable Labels ...................................................................................................................................23Discrete I/O Labels ................................................................................................................................24User Memory Screens ............................................................................................................................25User Memory Database Editor ...............................................................................................................26RTU Script Language Editor .................................................................................................................27Revision Notes Editor ............................................................................................................................28Data Table Viewer ..................................................................................................................................29Display Module Emulator ......................................................................................................................30Debug Terminal ......................................................................................................................................31

RTU Script Language Syntax ......................................................................................................................32Personality Module Memory Map ...............................................................................................................51Station and Group Data Structure ................................................................................................................52Station Data Flow Diagram .........................................................................................................................53Station Address Table ...................................................................................................................................54RTU32 Protocol Message Types ..................................................................................................................55RTU Protocol Message Types ......................................................................................................................56Control Group Flowchart .............................................................................................................................57Message Type Table .....................................................................................................................................58

Page 3: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 3 -

Introduction

This manual is intended to be the source of all information concerning the Micro-Comm S4500 PLC.

The S4500 is a fourth-generation Micro-Comm RTU/PLC built on the S4000 motherboard utilizing a new daughterboard with a faster 32bit microprocessor and more RAM and FLASH memory. As a result, the S4500 software has the following enhanced features:

I/O capabilities:(8) Relay outputs with confirmation read-back inputs(8) Open-collector outputs(16) Discrete inputs (contact closure) / low speed pulse inputs (up to 50Hz)(8) 12-bit analog inputs (0-20mA or 0-5volt dip switch selectable)(8) additional 12-bit analog inputs (4) 0-5volt analogs AI9-AI12 on the terminal blocks (4) internal signals: RTU temperature (0.25 to 4.75v = -50C to +150C = -58F to +302F), Battery Voltage (0 to 5v = 0 to 25.5 volts from battery), Battery Current (0 to 5v = -10 to +10 amps from battery) plus an input on COM1 25pin port(2) Pulse inputs - high speed (2.5kHz/500Hz)(2) RS-232 communication ports - COM1 is the radio (COM1B=9pin monitor port, COM1A=25pin for radio cable) - COM2 is a 9pin port normally used for the display module and programming(1) RS-485 communication port

- COM3 is a 4-wire RS-485 port for I/O modules or for PLC communication(12) Address input switches

Changes and Enhanced Features:• Setup requires the new “RTU Configuration 32” program• New data table and user memory viewing options in RTU Configuration 32• New Micro-Comm RTU32 Protocol with 16bit analog data and more• New personality module required with 1MB of serial flash (yellow label)• User Memory is now 9000 words of non-volatile RAM• User NV Memory is now 65000 words of personality module FLASH• User Memory screens added to Micro-Comm display module for custom variables/parameters• Much larger communication buffers for relaying and programming• Additional protocols on all COM ports (DF1 Half-Duplex Master, DF1 Full-Duplex, Modbus/TCP etc.)• Modbus and DF1 Half-Duplex Store & Forward (SFTABLE function) on COM1• PID for up to 8 analog outputs can now all be running at the same time• Increased maximum script and subroutine size (16KB for main, 2KB for each subroutine)• Added more subroutines SUB5()-SUB20() and increased # of parameters to 16 (L1-L16)• Additional pulse inputs (50Hz max) using DI1-DI16 are now available - PI3-PI18• New script variables for runtimes and cycle counts for DI1-DI16 and DO1-DO8• Added the RESPOND() script function that can define up to 128 more addresses• Added the LISTEN() script function that can listen to up to 128 other RTU replies and save the data• New script functions: TOTALIZE(),MCOPY(),MFILL(),MAVG(),OSR(),PITOAI(), XCOPY()• SCALE() function no longer changes the given variable, it just returns the scaled value• New script variables M0-M8999 to make access to user memory locations much easier• Added the GROUP() and CGLEVEL() functions to define and automate control groups for SCADAview 32• New CTU32 protocol option on COM2 and COM3 for use with SCADAview 32• Added COM2 baud rate and PTT time options for data radio support• DF1 Radio Modem protocol for all COM ports along with Store & Forward option on COM1• Revision notes / commented script can now be stored in the personality module (up to 64K bytes)• A compressed PC file can now be stored in the personality module (up to 256K bytes)

Page 4: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 4 -

I/O• 8 Form C Relay Outputs, 5A @ 250VAC • 8 Open Collector Outputs, 100mA @ 12VDC• 16 Optically Isolated Discrete Inputs, Dry Contact or Pulse Inputs (50Hz max)• 2 Optically Isolated High Speed Pulse Inputs,

(Input 1=2.5kHz max, Input 2 = 500Hz max)• 1 Pulse Amplification Circuit for Direct Connection to Flow Meter• 12 Analog Inputs 8ch, 12bit, 0-5V or 0-20mA Switch Selectable 4ch, 12bit, 0-5V• 1 Analog Amplifier Circuit• 4 Additional On-Board Sensor Analog Inputs Box Temperature,-58 to +302°F Battery Current, ±10A System Voltage

Communications• COM-1A, Radio Port 25pin Sub-D Male, RS-232 and RF signals• COM-1B, Radio Monitor Port 9pin Sub-D Male TxD, RxD, RTS, GND• COM-2, Front Panel Display, etc. 9pin Sub-D Male RS-232 with RTS• COM-3, RS-485• Plug In RF MODEM 0-300, 600, 1200 BAUD

CPU and Memory• 32bit MCU running @ 16MHz• 1MB FLASH EPROM, Application Program• 512KB RAM, Data and Comm buffers• 8K EEPROM, Configuration

Power Source and Supplies• 120/240 VAC Power Input Isolation transformer

and Surge Suprestion• SOLAR charging circuit• Battery charging and backup circuit• 13.8VDC @ 8A Switching Power supply• 12 to 24VDC @ 200mA Sensor Excitation power supply

SCADA Systems: Water Distribution Control and Management Waste Water Control and Monitoring Golf Course Irrigation Agricultural Irrigation Gas and Oil Monitoring Electrical Distribution Monitoring

Local Control: Constant and Variable Speed Pump Stations Metering Stations Water and Waste Water Treatment Plants

The S4500 RTU is a reliable, full-featured Remote Terminal Unit. It is a "smart" unit providing both programmability and interchangeability through a plug-in memory module. As an integrated component of a Supervisory Control and Data Acquisition System (SCADA), the S4500 provides input and output (I/O) monitoring and control with simultaneous "distributed" (RTU to RTU) and "central" (CTU to RTU) type control operations. Its universal communications interface can provide robust control and data transfer via radio, dedicated line, phone line, and fiber optic communication media.

Part Number for Ordering: L15F-L17A

Applications:

Description: Specifications:

Modem: 0 - none (110-19200 baud RS-232) L17 - 0-300 baud radio modem L17A - 0-600 baud radio modem L17B - 0-1200 baud radio modem (Bell 202)

Specifications and Sales Information

Page 5: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 5 -

Board Connections and Jumpers

The diagram below shows where all I/O terminal blocks, communications ports, jumpers, switches and other important items are located.

COM2

COM1B

COM1A

Processor Board

Radio Modem

ON/OFF

AUX I/O

DTR12V

COM3

AA-OUT AGND

Analog Input Switches RTU Address Switches1

0

0-20mA

0-5V

TX+TX-RX+RX-SGND+12VGND

Output Relays

NV RAM Battery CR2032

Page 6: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 6 -

Sample Wiring Diagram

GND

+24VAC

-24VAC

POWER CONNECTION:120VAC Power by Others - useseparate 15A circuit breaker.

120VAC/24VACTransformer

(by Micro-Comm)

15A-C B

S4500 RTU PANEL

L1

N

G

POWER CONNECTIONS - TB1

BATT+

BATT-

? A/Hr Battery

DISCRETE OUTPUTS - TB2/TB3

Pump #1 CallDO1-NO

DO1-C

DO1-NC

Discrete Ouput #1

Pump #2 CallDO2-NO

DO2-C

DO2-NC

Discrete Ouput #2

Pump #3 CallDO3-NO

DO3-C

DO3-NC

Discrete Ouput #3

DO6-NO

DO6-C

Telemetry Control - Fails Closed(wired in series with existing pressure backup"CALL")DO6-NC

Discrete Ouput #6

Valve #1 CallDO7-NO

DO7-C

DO7-NC

Discrete Ouput #7

Valve #2 CallDO8-NO

DO8-C

DO8-NC

Discrete Ouput #8

Page 7: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 7 -

S4500 RTU PANEL

DISCRETE INPUTS - TB4/TB5DI1

COM

Aux.

Discrete Input #1Pump #1 Run

DI2

COM

Aux.

Discrete Input #2Pump #2 Run

DI3

COM

Aux.

Discrete Input #3Pump #3 Run

DI4

COM

Discrete Input #4

DI5

COM

Discrete Input #5

DI6

COM

Discrete Input #6

DI7

COM

Aux.

Discrete Input #7Valve #1 Open

DI8

COM

Aux.

Discrete Input #8Valve #2 Open

DI9

COM

Discrete Input #9

DI10

COM

Discrete Input #10

DI11

COM

Discrete Input #11

DI12

COM

Discrete Input #12

DI13

COM

Discrete Input #13

DI14

COM

Discrete Input #14

Page 8: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 8 -

S4500 RTU PANEL

DI15

COM

Discrete Input #15

DI16

COM

Discrete Input #16

DISCRETE INPUTS - TB4/TB5

ANALOG INPUTS - TB7 thru TB9

24V-EX

AA+

AGND

Analog Input #1 with amplifier circuit

+

-

GND

Micro-Comm60 psi

Transducer

3 conductor shielded cable

shield connected to GND

AA-OUT

AI1

R-

R+

JUMPER

SpanResistor

AA-

AGND

JUMPER

Tank Level Transducer0-60 psi = 4-20mA

24V-EX

AI2

AGND

Analog Input #2

Discharge Pressure Transducer0-300 psi = 4-20mA

+

-

GND

Micro-Comm300 psi

Transducer

3 conductor shielded cable

shield connected to GND

PULSE INPUTS - TB6

3 conductor shielded cable12V-EX

PI1

GND

Pulse Input #1Electronic Flow Meter Head

+

Sig

Gnd

Flow MeterHead

(by others)

shield connected to GND

3 conductor shielded cable12V-EX

PI2

GND

Pulse Input #2Electronic Flow Meter Head

+

Sig

Gnd

Flow MeterHead

(by others)

shield connected to GND

Page 9: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 9 -

S4500 RTU PANEL

RADIO CONNECTION - COM1A25 Pin Male Sub-D Connector

Pin 16

Pin 14Pin 19

12VDC

TXA

RXA

PTT

MotorolaModel SM50

Radio

BLK

12345678

RJ-45Jack

GND

GND RED

GRY

12 AWG BLK + Pwr- Pwr

Radio Connection: Radioconnected to S4500 using 8 conductor flat phone cable with 25 pin female Sub-D connectorto RJ-45 phone plug. Antennaconnected to lightning arrestor using RG8U coax.

Pin 13Pin 12

39KΩ Resistor

12VDC12 AWG RED

Pin 7GRN

GND TB1 MDL 4A

FUSE

Antenna

CoaxLightningArrestor

H - 1111

I - 1110

J - 1101

K - 1100

L - 1011

M - 1010

N - 1001

O - 1000

P - 0111

Q - 0110

R - 0101

S - 0100

T - 0011

U - 0010

V - 0001

W - 0000

Station Address Dip Switch-SW2RTU #1 Address = ??

RTU #2 Address = ??

Switches 1-4 set RTU #2's first characterSwitches 5-8 set RTU #1's first characterSwitches 9-12 set both RTU's last character

RTU ADDRESSSELECTION SW2

1 5 9

ON = 1

OFF = 0

Page 10: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 10 -

S4500 RTU PANEL

Discrete Output #7

AUXILIARY OUTPUTS25 Pin Female Sub-D Connector

Pin 4

Pin 5

Pin 6

Pin 7

Pin 8

Pin 9

Pin 10

Pin 11

Pin 12

Pin 13

Pin 16

Pin 17

Pin 18

Pin 19

Pin 20

Pin 21

Pin 22

Pin 24

Pin 25

Pin 23

Discrete Output #5

Discrete Output #3

Discrete Output #1

+13.8VDC

+13.8VDC

Software Output #1 (DO9)

+13.8VDC

+13.8VDC

Discrete Output #8

Discrete Output #6

Discrete Output #4

Discrete Output #2

?

?

?

?

?

?

?

?

Pump #1 Call Lamp

Door Mounted12VDC LED Lamps

Pin 4

Pin 9Pin 8

Pin 5Pin 6Pin 7

Pin 3Pin 2Pin 1

Pump #2 Call Lamp

Pump #3 Call Lamp

Telemetry Control Lamp

Valve #1 Call Lamp

Valve #2 Call Lamp

CDRXDTXDDTR or 13.8VDCSGDSRRTSCTSRI

FRONT PANEL DISPLAY-COM29 Pin Female Sub-D Connector

RED

SMT Displaywith keypadYEL

GRNWHTBLU

BLK

FRONT PANEL DISPLAY:Operator Interface with LCDdisplay and keypad. Displays local analogs, controllingtank's level, and provides access to control setpoints.

5416

23

RJ-11Jack

FRONT PANEL LAMPS & DISPLAY with KEYPAD

NOTE: Jumper on the Motherboard should be set to 12V to power the Display Module (not DTR)

Software Output #2 (DO10) Software Output #3 (DO11) Software Output #4 (DO12) Software Output #5 (DO13) Software Output #6 (DO14) Software Output #7 (DO15) Software Output #8 (DO16)

?

?

?

?

?

?

?

?

Page 11: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 11 -

Expansion I/O Module Setup

Dip switches set both the address of the module and the baud rate used by the RS-485 connection to the RTU.

The EDI16, EDO16, EAI8 and EAO4 modules allow an RTU to have additional discrete or analog inputs/outputs. These modules are connected to the RTU using the COM3 terminal block on the S4500. Both power and communication lines are provided by the RTU.

1 2 3 4 5 6 7 8

ON

TX+TX-RX+RX-SGND+12VGND

RTUTX+TX-RX+RX-SGND+12VGND

I/O Module

Switches 1-7 set the address:Module #1 = switches 1-7 offModule #2 = switch 1 on, 2-7 offetc.

The baud rate is set using switch 8:9600 baud = switch 8 off19200 baud = switch 8 on

The default baud rate used by the RTU is 9600 baud. This can be changed in the RTU Configuration 32 program if necessary. The normal COM3 Mirco-Comm I/O polling loop will take around 2.6 seconds to update all modules at 9600 or around 0.7 seconds at 19200 baud. Micro-Comm I/O protocol on COM3 currently supports (4) EDI16, (4) EDO16, (4) EAO4 and (2) EAI8 modules.

All modules use Modbus RTU protocol and will be communicated with automatically using the “Micro-Comm I/O” protocol or can be communicated with manually using the MESSAGE() or MIOMSG() functions in script.

(EAI8 Module)

Page 12: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 12 -

Display Module Operation

The Micro-Comm display module allows the operator to view up to 32 analog levels, 32 discrete input conditions, 32 discrete output conditions, change up to 32 stop/start setpoints, change all 8 output timer settings (both on and off delays) , view/change the user variables (X1-X32) and view/change user memory with up to 128 screens. In addition to these options there is a debug mode available that will let the operator turn on and off outputs, check inputs and view communications.

General Instructions:• Use the Up/Down arrows to move between categories (analog level displays, discrete inputs and

outputs, timer settings, stop/start setpoints, user variables and user memory screens)• Use the Right/Left arrows to move between items (which analog screen, timer output etc.)• Press ENTER to start entering a value for timers or setpoints.• Use the number keys to enter values. Use BKSP if you need to backspace.• Press ENTER when done with each entry.

Special Modes:• Type .123 to get into the debug mode. Then hit the ENTER key to see a menu of choices.• Type .456 to get into the view communications screen. All radio communication data will then appear

on the display. Press the up arrow to get out of this mode.• Type .741 to temporarily go from CTU32 mode to display mode. Note: This will only work if

“hankshake” is disabled ahead of time since the RTS line will normally be off - see setup below.

NOTE: The display communicates with the RTU using a serial cable (9 pin to RJ-11). The protocol options should be set to 9600 baud, 8 data bits, none parity, echo disabled. These are the factory defaults. To set a display back to factory defaults, hold down the PERIOD, ZERO and F1 keys during power up and then press the F1 key to load the defaults. The default for “handshake” is “enabled” (this will need to be disabled if you plan to use the temporary display mode described above).

To change these parameters, press the PERIOD, ZERO and F1 keys any time after power up.

1 2 3

4 5 6

7 8 9

. 0 SPACE BKSP ENTER

NOYES

TOWER LEVEL 12.9 FTDISCHARGE 120 PSI

Page 13: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 13 -

Micro-Comm RTU32 Protocol I/O Layout(older Enhanced Control Card)

The new RTU32 protocol is currently available only by using Message() commands from another S4500. When being polled from a C2000 or Card Rack CTU, the older Enhanced Control Card protocol will be used. The table below shows how the physical I/O in the S4500 is mapped for both protocols:

New RTU32 Protocol LayoutS4500 Station Address #1Relay outputs DO1-DO8 Discrete outputs 1-8Discrete inputs DI1-DI16 Discrete inputs 1-16EDI Modules 1,2 DI17-DI48 Expansion inputs 1-32Analog inputs AI1-AI8 Analog inputs 1-8M8030-M8033 Analog Outputs 1-4M8012 Flow Rate (16bit)M8013,M8014 Flow Total (32bit)

S4500 Station Address #2Open Collector DO9-DO16 Discrete outputs 1-8EDI Module 3 DI49-DI64 Discrete inputs 1-16EDI Modules 4,5 DI65-DI96 Expansion inputs 1-32Analog inputs AI9-AI16 Analog inputs 1-8M8130-M8133 Analog Outputs 1-4M8112 Flow Rate (16bit)M8113, M8114 Flow Total (32bit)

Old RTU Protocol LayoutS4500 Enhanced Control Card #1Relay outputs DO1-DO6 Discrete outputs 1-6Discrete inputs DI1-DI6 Discrete inputs 1-6Discrete inputs DI9-DI16 Input Expansion Module inputs 1-8EDI Module #1 (DI17-DI32) Input Expansion Module inputs 9-24DO9-DO16 status Input Expansion Module inputs 25-32Low 8-bits of analogs AI1-AI6 Analog inputs A,B,C,D,E,FPulse Input PI1 Pulse InputM8030-M8031 Analog Outputs 1-2 (8 bit)

S4500 Enhanced Control Card #2Open Collector DO9-DO14 Discrete outputs 1-6Discrete Inputs DI7-DI8 Discrete inputs 1-2EDI Module #4 (DI65-DI68) Discrete inputs 3-6EDI Module #2 (DI33-DI48) Input Expansion Module inputs 1-16Relays Dones (DO1TD-DO8TD) Input Expansion Module inputs 17-24DO9-DO16 status Input Expansion Module inputs 25-32Low 8-bits of analogs AI7-AI12 Analog inputs A,B,C,D,E,FPulse Input PI2 Pulse InputM8130-M8131 Analog Outputs 1-2 (8 bit)

Page 14: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 14 -

Allen-Bradley DF1 and Modbus Protocol Support

The S4500 can use Allen-Bradley DF1 or Modbus RTU protocols. The information below describes what protocol options are supported and how the data is mapped to physical I/O or memory locations in the S4500:

DF1 SLC-500 File Modbus 4x Reg Modbus I/O PLC I/O and Memory RegistersN9:0 r 4x0001 r 10001-10016 r Discrete Inputs DI1-DI16

N9:1 r 4x0002 r 10017-10032 r EDI #1 Discrete Inputs DI17-DI32

N9:2 r 4x0003 r 10033-10048 r EDI #2 Discrete Inputs DI33-DI48

N9:3 r 4x0004 r 10049-10064 r EDI #3 Discrete Inputs DI49-DI64

N9:4 r 4x0005 r 10065-10080 r EDI #4 Discrete Inputs DI65-DI80

N9:5 r 4x0006 r 10081-10096 r DI81-DI96

N9:6 r 4x0007 r 10097-10112 r DI97-DI112

N9:7 r 4x0008 r 10113-10128 r DI113-DI128

N9:8 r 4x0009 r 10129-10144 r DI129-DI144

N9:9 r 4x0010 r 10145-10160 r DI145-DI160

N10:0 r/w 4x0011 r/w 00001-00016 r/w Discrete Outputs DO1-DO16

N10:1 r/w 4x0012 r/w 00017-00032 r/w EDO #1 Discrete Outputs DO17-DO32

N10:2 r/w 4x0013 r/w 00033-00048 r/w EDO #2 Discrete Outputs DO33-DO48

N10:3 r/w 4x0014 r/w 00049-00064 r/w EDO #3 Discrete Outputs DO49-DO64

N10:4 r/w 4x0015 r/w 00065-00080 r/w EDO #4 Discrete Outputs DO65-DO80

N10:5 r/w 4x0016 r/w 00081-00096 r/w DO81-DO96

N10:6 r/w 4x0017 r/w 00097-00112 r/w DO97-DO112

N10:7 r/w 4x0018 r/w 00113-00128 r/w DO113-DO128

N10:8 r/w 4x0019 r/w 00129-00144 r/w DO129-DO144

N10:9 r/w 4x0020 r/w 00145-00160 r/w DO145-DO160

N11:0 – N11:4 r/w DO81-DO160

N12:0 - N12:63 r/w 4x0021-4x0084 r/w 30001-30064 r AO1-AO64

N13:0 - N13:63 r 4x0085-4x0148 r 30065-30128 r AI1-AI64

N14:0 - N14:31 r/w 4x0149-4x0180 r/w 30129-30160 r PI1-PI32

N15:0 - N15:63 r/w 4x0601-4x0664 r/w Stop/Starts 1-32 STOP1,START1,STOP2,START2 etc.

N16:0 - N16:191 r/w 4x0201-4x0424 r/w X Variables X1-X224 (16 bit words)

N17:0 - N17:63 r 4x0701-4x0764 r Timer Variables TSEC1-TSEC64 (16 bit @ 1sec/bit)

N19:0 - N19:15 r/w 4x1201-4x1216 r/w ON/OFF Timer Settings (ON1,OFF1,ON2,OFF2 etc.)

N20:0 - N20:99 r/w 4x3000-4x3099 r/w User Memory Locations 0-99 (16 bit words)

N21:0 - N21:99 r/w 4x3100-4x3199 r/w User Memory Locations 100-199

N22:0 - N22:99 r/w 4x3200-4x3299 r/w User Memory Locations 200-299

… … …

N109:0 - N109:99 r/w 4x11900-4x11999 r/w User Memory Locations 8900-8999

Modbus SpecificationsProtocol Mode: Modbus RTU Master/Slave and Modbus/TCPError Checking: CRC-16Function Codes Supported: 1-Read Coil Status, 2-Read Input Status, 3-Read Holding Registers, 4-Read Input Registers, 5/15-Force Single/Multiple Coils, 6/16-Preset Single/Multiple Registers

DF1 SpecificationsData Link Layer Protocol: DF1 Half-Duplex Master/Slave, DF1 Full-Duplex or DF1 Radio ModemError Checking: CRC-16Message Packet Formats: SLC-500 Protected Typed Logical Reads/Writes PLC-5 Word Range Read/Write PLC-2 Physical Read/Write Basic Command Set - Unprotected Read/Write

Page 15: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 15 -

Program Installation

A new version of RTU Configuration is required for programming the S4500 and later 32 bit PLCs. For lack of a better name, this new program is called “RTU Configuration 32”. Throughout this manual the program will be called “RTU Configuration 32” or “RTU Config”.

RTU Configuration 32 is currently available for Windows NT/2000/XP and Mac OS X 10.2 or later.

To Install the Windows version, follow the steps below:

When upgrading to a new version of the program, go to the Control Panels in Windows and double-click on Add/Remove Programs. Look through the list and remove any old versions of RTU Configuration.

1) Insert the CD into the CD-ROM Drive.2) RUN the SETUP program located on the CD-ROM.3) Follow the prompts and do a typical install.4) After installation, the program icon will appear in the Start menu’s Program list.

When running the configuration program for the first time you will need to look at the serial port setup screen to make sure you have the correct COM port number selected. The port setup is located in the program’s “Edit - Preferences...” menu. Connection to the S4500 is by means of a Null-modem cable from the computer’s RS-232 port to the S4500 COM2 port (display port).

S4500 Configuration

Page 16: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 16 -

RTU Information Screen

The RTU Information screen contains version, date, checksums, user information, address switch settings as well as a picture of the RTU. This information about the RTU will be available after the user has read the Personality Module. The Job Name and Site Name fields can be changed if necessary and the User Name and Last Programmed will reflect who made the most recent change. All the “User” information is sent to the RTU whenever the personality data is uploaded.

Page 17: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 17 -

Configuration Parameters

The screen below shows a sample RTU Configuration dialog box. This screen is where all the operational parameters stored in the Personality Module can be changed (radio communications parameters, output timer settings, automote control settings and stop/start setpoints).

To retrieve the personality data from an S4500, click on the blue down arrow icon or select Read Personality Data from the Transfer menu. After making changes, click the blue up arrow icon or select Program Personality Data from the Transfer menu.

Page 18: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 18 -

RTU Configuration Parameters

Model Number The model of the RTU being configured is selected and shown here.

Protocol The protocol selection for the radio communications port (COM1). Options include Micro-Comm RTU32, DF1 Half-Duplex Slave, DF1 Half-Duplex Master, DF1 Full-Duplex, DF1 Radio Modem, Modbus RTU Slave, Modbus RTU Master or Modbus/TCP.

Baud Rate This selects the speed for the radio communications port (COM1). 110, 300, 600, 1200, 2400, 4800,

9600, 19200, 38400, 57600 and 115200 bps are supported.

Parity Parity checking mode (Even, Odd or None). Even parity should normally be selected when using Micro-Comm RTU protocol.

Data Bits The number of data bits used by the radio port (5, 6, 7 or 8). This should normally be set to 7 for Micro-Comm RTU communications.

Stop Bits The number of stop bits used by the radio port (1 or 2). This should normally be set to 2 for Micro-Comm RTU communications.

PTT Time in milliseconds that will occur after the radio is keyed and before the data is sent out the radio port. This should normally be set to 250 msec or more for Micro-Comm RTU communications using conven-tional radios. Data radios will allow for much lower PTT times (50 msec or less).

Ant. Outputs The range of 8 discrete outputs to use when a remote is doing Antenna/Radio switching. RTU32 proto-col can only specify an 8 bit mask so this selection allows it to be applied to outputs 1-8 or 9-16.

Ant. Default Discrete ouput number to leave on for Radio #1 when doing Antenna/Radio switching at a remote.

Station # For use with Modbus or DF1 protocols ONLY. This sets the station # for this RTU as used by the proto-col on all of the communication ports.

COM2 Protocol Communication protocol used on COM2. This can be Micro-Comm Display, Micro-Comm RTU32, Micro-Comm CTU32, DF1 Half-Duplex Slave or Master, DF1 Full-Duplex, DF1 Radio Modem, Modbus RTU Slave or Master, Modbus/TCP or Web Server.

COM2 Baud This selects the speed for the COM2 port. The default is 9600 baud for compatibility with the Micro-Comm Display Module.

COM2 PTT Time in msecs that will pass after RTS is turned on and before data is sent out COM2. The default is 0 which will leave the RTS turned on all the time.

COM3 Protocol Communication protocol used on COM3. This can be Micro-Comm I/O, DF1 Half-Duplex Slave or Master, DF1 Full-Duplex, DF1 Radio Modem, Modbus RTU Slave or Master, Modbus/TCP, Micro-Comm Display, Micro-Comm RTU32 or Micro-Comm CTU32.

COM3 Baud Communications speed for the Micro-Comm I/O modules or for Modbus RTU / DF1 communication. The default is 9600 baud.

Page 19: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 19 -

Output Timer SettingsThe timer settings control how long the RTU will wait to energize or de-energize a relay output when it has been told to come on or go off. These timers will always be used regardless of the mode of operation - Micro-Comm CTU control, Script Lan-guage, Modbus or DF1.

Stop/Start Setpoints 1-32These setpoints can be labeled and accessed from the Micro-Comm Display module and then used in script for control.Stop and Start setpoints are scaled using the analog selected in the Stop/Start Labels screen.

Use 8-bit Remote SetpointsThis option will force the remote setpoint protocol (used by SCADAview) to use 8-bit (LSB) values. This may be required if the central is a C2000 or earlier.

Pulse Dividers These sets the number of pulses that must occur before the pulse input counter is incremented. Normally this will be set to 1.

Page 20: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 20 -

Analog Labels and Scaling Factors

To change analog labels and scaling factors, click on the blue water tower icon or select Analog Labels & Scales from the View menu. The labels and scales are retrieved/sent to the S4500 during reading/writing of the personality module configuation data.

Up to 32 analog levels can be displayed and they will always appear in the order entered in the setup screen. If an analog label is left blank it will not show up on the display.

When analog levels are displayed, the offset is first added to the raw analog value and the result is then multiplied by the range value. (This matches the Micro-Comm SCADAview program). A Range/Preset calculator (shown below) can be displayed by right-clicking and selecting the menu option.

Page 21: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 21 -

Output Timer Labels

To change the 20 character output timer display labels, click on the clock icon or select Timer Labels from the View menu. The labels are retrieved/sent to the S4500 during reading/writing of the configuration data. These labels are normally used for pumps and provide both ON and OFF delays entered on the Micro-Comm Display Module.

Note: Lines where the label is left blank will not be accessible from the Display Module.

Page 22: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 22 -

Stop/Start Setpoint Labels

Stop/Start labels are used on the Display Module to allow the operator to change operational parameters such as Pump Stop/Start setpoints, High/Low alarms and Pump Restore/Cutoffs. Along with the 20 character label is a selection for what type of setpoint (Stop/Start, High/Low etc.) and which analog input # will be used for scaling and units.

Note: Lines where the label is left blank will not be accessible from the Display Module.

Page 23: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 23 -

X Variable Labels

User variables are the 16-bit unsigned integer X1-X32 script language variables that can be used for any purpose. By entering a label in the User Variable Labels setup screen, the current value will be shown and can be changed on the Display Module.

Page 24: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 24 -

Discrete I/O Labels

Labels for both 32 discrete inputs and 32 discrete outputs are user defined in the S4500 software. These labels may be used to display pump calls, pump runs, valve positions, alarms etc. A 12-character label is used to name the input or output along with a 6-character ON label and a 6-character OFF label to describe the on or off state. If the input or output name is left blank it will not appear on the display and if no discretes are labeled the display will just skip over the entire section (inputs or outputs).

The screen below shows the Discrete Input Labels setup screen:

Page 25: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 25 -

User Memory Screens

User memory screens allow for display and entry of data stored in user memory (locations 0-8999). The raw data type can be a 16-bit unsigned integer (1 user memory location), a 32-bit unsigned integer (2 consecutive user memory locations) or a 32-bit floating point number. This data can then be displayed as numeric values, discrete labels or binary numbers given various parameters.

The user memory screens are accessed by arrowing all the way down to the bottom row of the Micro-Comm display. The left and right arrows will then select the desired user memory screen.

The sample screens below show how a 32-bit flow total could be displayed and how a Pump HOA could be configured.

Page 26: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 26 -

User Memory Database Editor

The User Memory Database screen provides the capability of reading, programming and editing all user memory locations (0-8999) as well as saving and loading a comma seperated (.CSV) database file. This file could then be used for data logging/trending or saving a backup copy of important data such as flow totals, runtimes etc. The screen shown below is accessed from either the Utilities menu or by selecting “Read User Memory” from the Transfer menu.

Right-clicking on this screen will bring up a menu with options to “Read User Memory”, “Program User Memory”, “Save CSV File...” and “Load CSV File...”. Double-clicking on a cell will put it into edit mode and a new integer value can be entered. The data will be displayed and entered in decimal unless the “Display User Memory and X Variables in Hex” is selected in the preferences.

This screen can also be made to show “live” data like the user memory data table viewer by selecting the “Auto-Refresh User Memory Database Window” option in the application preferences.

NVRAM DatabaseIn addition to the User Memory Database, there is also a very similar NVRAM Database window which can be used to download and save data from the RTU’s personality module. This could be used for long-term data logging since it currently supports 65000 words of data. The script commands NVREAD(), NVWRITE() and NVCOPY() are used to manage this data.

Page 27: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 27 -

RTU Script Language Editor

To enter or edit the Script Language Code, click on the script icon in the tool palette or select “Script Editor” from the View menu.

Script language can be retrieved from the RTU by clicking the Read button shown at the bottom of the editor window or by selecting Read RTU Script from the Transfer menu.

Lines starting with a single quote character are comments and do not get sent to the S4500 when programming. Comments are only saved in the .S5C configuration file.

After entering lines of code the user can click the Check button to make sure the syntax looks ok and to see how many bytes of code have been used. Currently the main script code can’t be larger than 16895 bytes.

The code is then programmed into the RTU’s personality module by clicking the Program button or by selecting Program RTU Script in the Transfer menu.

Script subroutines are edited by selecting the subroutine number from the list in the lower-left corner of the screen. Each subroutine can be read, programmed and checked separately using this editor. Currently each subroutine can be up to 2110 bytes.

Page 28: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 28 -

Revision Notes Editor

To enter or edit the Revision Notes for the RTU, click on the notepad icon or select Revision Notes from the View menu. The screen below shows some sample notes - they can be script comments, software description, revision history, variable tables or anything else desired.

The Read and Program buttons are used to retreive or store the notes into the personality module. Revision notes are also saved in the .S5C configuration file.

If the option “Use Commented Script for Revision Notes” is turned on in the preferences, this screen will be filled in with the current commented script whenever it is opened. It can then be programmed into the personality module in addition to the un-commented (compiled) script. The user will also then be asked if the commented script should be programmed whenever the configuration or compiled script is programmed. Commented scripts can be read back from an RTU and imported into the actual script by right-clicking and selecting the “Import Commented Script” menu option (shown below).

Page 29: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 29 -

Data Table Viewer

The Data Table Viewer screen allows the operator to see and change I/O variables, User variables and the Stop/Start setpoints in real-time when connected to an RTU. This screen can be very useful when debugging script language code. The User Memory data table can display all user memory (a range of 64 locations at a time) and will allow for changing these values.

Analog inputs and Stop/Start setpoints are displayed as raw 12-bit numbers (0-4095) or can optionally be scaled based on the range/offset values entered in the analog setup screen. Pressing the “S” key on this display will toggle scaling on and off. Discrete inputs and outputs are shown as either 1 or 0 (on or off).

When the “Force I/O” option is selected, the I/O variables shown in red may be changed to the desired value by clicking on the readout box, typing a new value and pressing enter. When the “Disable Script” option is also checked, the script will stop running and any I/O that it was controlling will then be accessible.

Page 30: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 30 -

Display Module Emulator

The display module is an optional hardware component to a S4500 PLC which allows an operator to see levels and change setpoints. When programming the S4500 with the RTU Configuration 32 software the operator can use the Display Module Emulator screen to see what the display module would show. This can be very useful since both the display module and the programming software may be using the same com port on the RTU.

Page 31: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 31 -

Debug Terminal

The Debug Terminal screen allows the user to interact directly with the RTU over the programming port (COM2 or COM3) or with other third-party serial equipment. It will display incoming data using ASCII, Modbus or DF1 mode based on the “Display Mode” selection in the lower-left hand corner of the screen. Protocol analysis of master messages (requests) can be done by selecting “RTU32-Decode”, “Modbus-Decode” or “DF1-Decode”.

Data logging can also be done by clicking on the “Log Data...” button and typing in a file name.

Radio communications on COM1 can be monitored on COM2 or COM3 by clicking on the “Radio” button. COM2 communication can be monitored on COM3 by clicking the “COM2” button. COM3 communication can be monitored on COM2 by clicking the “COM3” button.

The “Debug” button will enter a hardware debugging mode where outputs can be turned on and off, inputs can be read, the clock can be set etc. Press the Enter key when in this mode to get a menu.

Page 32: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 32 -

RTU Script Language SyntaxRTU32 Script Language Reference Rev. 1.9.9 – 6/1/2007

Numbers: 16-bit unsigned integers (0 to 65535) - all computations (except in special functions) are done using unsigned integers.

Variables: DI1-DI160 Discrete inputs 1-160 (1=on, 0=off) DO1-DO160 Discrete outputs 1-160 DO1TD-DO8TD Discrete output 1-8 Timer Done (1=relay is energized) DI1RT-DI16RT Runtimes for DI1-DI16 (tenths of hours) DI1RC-DI16RC Cycle counters for DI1-DI16 (# of starts) DO1RT-DO8RT Runtimes for DO1-DO8 (tenths of hours) DO1RC-DO8RC Cycle counters for DO1-DO8 (# of starts) AI1-AI64 Analog inputs 1-64 (AI1-AI16 are on-board, AI17-AI24 are the EAI8 module) AO1-AO64 Analog outputs 1-64 (AO1-AO8 are EAO8 modules 1-4) PI1-PI64 Pulse input 16bit counters (PI1-PI18 are physical, PI19-PI64 are script-only) TSEC1-TSEC224 General purpose seconds timers (count down, 0 to 65535 seconds) STOP1-STOP32 Stop setpoints (16bit) - read only START1-START32 Start setpoints (16bit) - read only X1-X224 User X variables (16bit) - read/write Xx.0-Xx.15 Bit referencing of user X variables (returns 0 or 1) - read/write M0-M8999 User memory variables (16bit) - read/write Mx.0-Mx.15 Bit referencing of user memory variables (returns 0 or 1) - read/write L1-L16 Local subroutine variables (16bit) - read/write Lx.0-Lx.15 Bit referencing of local subroutine variables - read/write T1AI1-T1AI8 LISTEN() address #1’s analog input data T2AI1-T2AI8 LISTEN() address #2’s analog input data T1DI1-T1DI32 LISTEN() address #1’s discrete input data T2DI1-T2DI32 LISTEN() address #2’s discrete input data T1PI1,T2PI1 LISTEN() address #1,#2 raw pulse inputs or flow rates FIRSTPASS Set to a “1” on the first pass of script execution (read-only) POWERFAIL Set to a “1” and held to 2 minutes when a power fail is detected (volts<13.05) MIOLOCK Used to lock MIOMSG message instruction table in place (set to “1”) MSGLOCK1-MSGLOCK3 Used to lock MESSAGE tables in place (per COM port) TSEC[x] array variable - indirect referencing for TSEC1-TSEC224 X[x] array variable - indirect referencing for X1-X224 M[x] array variable - indirect referencing for M0-M8999

Operators: + addition ++ post increment (must follow a variable) - subtraction -- post decrement (must follow a variable) * multiplication / division % remainder | OR (bitwise or) & AND (bitwise and) ! NOT (logical not - not 1=0 and not 0=1) ^ XOR (bitwise exclusive or) == is equal to (tests for equality) <> not equal to (tests for inequality) < less than > greater than <= less than or equal to >= greater than or equal to = assignment (sets a variable equal to something)

Page 33: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 33 -

Functions:

AFAIL(af#, rawvalue, lowlevel, flsecs, ftcsecs) Returns an analog sensor fail condition alarm based these parameters: af# - a unique analog fail function number (1-64) rawvalue - the current analog value passed-in prior to scaling lowlevel - the level at which a sensor-fail condition will be triggered flsecs - number of seconds before a fail-low will occur ftcsecs - number of seconds before a fail-to-change will occur Note: The function will return a “1” for fail-low, a “2” for fail-to-change and “3” if both of these conditions exist. Using a zero value for flsecs or ftcsecs will disable that type of alarm. Example: X1=AFAIL(1, AI1, 818, 10, 0) ‘returns a “1” if analog input is below 819 for 10 secs

AHIGH(ah#, alevel, highlevel, restore, failsecs, restsecs) Returns a “1” when there is an analog “high” condition given these parameters: ah# - a unique analog-high function number (1-64) alevel - the current analog level to be tested highlevel - setpoint at which the high-level should occur (after nsecs) restore - setpoint at which the high-level will clear (after nsecs) failsecs - # of seconds the level needs to be at or above the high level before alarming restsecs - # of seconds the level needs to be at or below the restore setpoint before the alarm clears Note: Setting both the highlevel and restore setpoints to zero will clear and disable the alarm.

AIN(ai# [,nsamples [,stime [,value]]]) Returns the value for a given analog input number given these parameters: ai# - analog input # (1-64) nsamples - optional number of samples to average (1-64 or 0 for no averaging) stime - optional time between the samples used in the average (in seconds) If stime is not given or is set to zero, the sample time will be approximately 250msec. value - optional value to set the analog input to, ignoring the other parameters Example: AI2=AIN(1,8,4) ‘averages the last 8 values for AI1, sampled every 4 seconds

AITOPI(ai#, pi#, 420flag) Sets the parameters for the real-time (background task) analog-to-pulse converter. Setting the ai# to 0

will disable the converter for the given pi#. The 420flag parameter tells the converter to use 4-20ma (819-4095) or 0-5volts (0-4095) for the input range. The pulse counter is incremented at a rate of 0 to 64 pulses per second based on the most recent analog input sample value.

ai# - analog input # (1 - 64) pi# - pulse input # (1 - 64) 420flag - analog scale (0=0-5volt, 1=4-20ma) Example: AITOPI(3,1,1) ‘converts a 4-20ma signal on AI3 to a pulse of 0-64pps on PI1

ALOW(al#, alevel, lowlevel, restore, failsecs, restsecs) Returns a “1” when there is an analog “low” condition given these parameters: al# - a unique analog-low function number (1-64) alevel - the current analog level to be tested lowlevel - setpoint at which the low-level should occur (after nsecs) restore - setpoint at which the low-level will clear (after nsecs) failsecs - # of seconds the level needs to be at or below the low level before alarming restsecs - # of seconds the level needs to be at or above the restore setpoint before the alarm clears Note: Setting both the lowlevel and restore setpoints to zero will clear and disable the alarm.

AOUT(ao# [,value]) Writes the the given value to the analog output #. Also returns the value of the given analog output #. If the value parameter is not given, it just returns the current value.

Page 34: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 34 -

BMSK([b0,...b15]) Returns an unsigned integer value with bits set as given in the parameters. This can be useful when creating and passing pump enable bit masks to the GROUP() function.

Example: X9=BMSK(X1,X2,X3,X4) This would set X9 equal to “15” if X1,X2,X3 and X4 are all equal to “1”.

BSET(mloc, bnum, bval) Sets a bit in memory referenced with mloc to a given value (0 or 1). A memory location in the RTU will correspond to it’s Modbus reference location shown in DF1-Modbus table minus 40000. Supported memory locations include all the I/O data (1-166), X Variables (201-424) and User Memory Locations (3000-11999).

BSHIFT(x, nbits, dir) Returns the value x shifted left or shifted right by the given number of bits (1-16). The value of dir specifies the direction of the shift (0=left, 1=right). Example: X1=BSHIFT(X2,8,1) This would return the MSB of X2 (X2 shifted 8 bits to the right)

BTST(mloc, bnum) Returns the value of a bit referenced with mloc given the bit number (0-15). (see the BSET function above)

CGBACKUP(gnum, nvloc) This function will back-up the given control group’s data (all 25 words) to the NVRAM location nvloc

(personality module) whenever a change is made to the group data. It will also restore the data from NVRAM to the control group if it detects invalid data (RAM failure or new RTU board?).

CGLEVEL(gnum, saddr1, ai#, saddr2, ai#, [...saddr8, ai#]) This function will return the lowest of the enabled controlling levels given the group # and a list of

station addresses and analog input numbers (1-8 or 9 for flow rate). It can be used in conjuction with the GROUP() function to allow multiple controlling levels. If no analog is enabled, a value of 65535 will be returned for pump-up groups, 0 for pump-down groups.

Example: X1=CGLEVEL(1,192,1,193,1) This would return the level from TH-AI1 or TI-AI1 depending on which level is lowest and is enabled

(not inhibited) in control group #1.

DIN(x [,value]) Returns the value for discrete input #x. The returned value will be 0 if the input is OFF and 1 if ON. If the optional parameter “value” is included, it will set the given discrete input to this value.

DOUT(x [,y]) Energizes or de-energizes output #x based on the value y. The value of y should be “0” to turn off an output and “1” to turn it on. Discrete outputs 1-8 will use the On and Off timer settings. This function also returns the current value of the output. If the optional parameter y is not given, it just returns the current value of the given output #.

DPVPFLOW(dp, dpe, vp, vpe, vsize, vtype, rexp) This function will return a flow rate given the differential pressure, valve position, valve size and type.

The following parameters are required: dp = given differential pressure dpe = exponent multiplier for dp (dp*10dpe) vp = given valve position (usually 0-100%) vpe = exponent multiplier for vp (vp*10vpe) vsize = valve size - valid sizes are 4,6,8,10,12,14 or 16 inches vtype = valve type (always 1 for now - Cla-Valve) rexp = result exponent multiplier (result*10rexp) Example: X1=DPVPFLOW(1000,-1,700,-1,16,1,0) returns a value of 32189.

Page 35: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 35 -

ENTRYALARM(doors, opresent, alarmtime, exittime) The entry alarm function will return a value of “1” after a given door switch condition is tripped

and a timer times out without being acknowledged with the operator present signal. The following parameters are used:

doors = door switches (1=all closed) or a variable meaning that all is secure opresent = operator present key switch input or variable used to disarm (1=disarmed) alarmtime = time in seconds after doors are tripped and before the alarm condition is returned exittime = time in seconds allowed for the operator to exit after arming the system Example: DI5=ENTRYALARM(DI4,DI3,120,120)

EXIT() or EXIT(x) Exits the script immediately without processing any more lines. This can be used to bypass whole sections of code based on some condition. It can also be used to exit a subroutine and optionally return a value (x) to the main script.

FOR(var, start, end, step, statements) This provides for-next loop functionality using a loop variable and executing the given statements a

number of times (up to 100 iterations). The parameters are: var = control variable to be incremented in the loop start = starting value for the variable end = ending value for the variable step = number to add to the variable each interation (usually 1) statements = multiple statements separated by “:” to be executed each interation Example: FOR(X1,1,8,1,AOUT(X1,0):DOUT(X1,0):TSEC[X1]=0)

FPCONV(x, xexp, uloc) Converts the given integer value x to floating point using the exponent multiplier - x*10xexp

The result is stored at the given user memory location (32 bits are required to store the floating point number, so uloc and uloc+1 are both used).

Example: FPCONV(12345,-2,100) ‘this stores a value of 123.45 in M100,M101

FPSCL(uloc, fl, fh, sl, sh [,wswap]) Returns a scaled value given a floating-point number at uloc, min/max floating point value (fl and fh)

and the min/max scaled value (sl and sh). The uloc is the starting memory location for the floating-point number (since floating-point numbers are 2 words in length). This function is normally used along with the MESSAGE command to convert floating-point numbers from a PLC to unsigned integer values. The optional parameter “wswap” will swap the 2 words before doing the calculation if it is set to a “1”. This may be necessary when looking at floating point numbers obtained from certain controllers such as Modicon PLCs.

For example, if a Modbus speaking PLC has a floating point number located at 40001/40002, the following two lines of script could be used to read and convert it to unsigned integer:

MESSAGE(3,0,1,40001,0,2,3000) X1=FPSCL(3000,0,1,0,10000,1) ‘convert from 0-1 floating-point to 0-10000 integer, swap words

FPTOLONG(fpuloc, longuloc, wswap) Converts a 32 bit floating point number to an unsigned long integer given the parameters: fpuloc = user memory location of the float longuloc = user memory location for the unsigned long (2 words) wswap = swaps the floating point words before conversion if set to “1” Example: FPTOLONG(2000,2002,0) ‘convert float at M2000 to unsigned long at M2002

GOTO(x) Jumps to the given label x marked in script by a line containing the LABEL(x) function. Note: Only forward jumps are allowed to prevent endless loops. Also, if the label does not exist, the

script or subroutine will exit. Example: IF(X1>10,GOTO(100)) X1=X1+1 LABEL(100) X2=X2+1

Page 36: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 36 -

GROUP(gnum, uloc, genable, gtype, clevel, psaddr, npumps, spump, penables, failsecs [,psaddr2, npumps2, spump2, psaddr3, npumps3, spump3, psaddr4, npumps4, spump4]) Control groups are used in conjuction with SCADAview 32 to do all the housekeeping for pump status,

alternation, fail generation etc. - similar to C2000 (CTU7-CTU9) based groups. The parameters are as follows:gnum group number (1-128)uloc memory location for the start of the crontol group data structuregenable group enable flag (1=enable, 0=disable) - group will alternate when disabledgtype group type (1=normal, 2=normal + RTU HOAs, 3=discrete given # of pumps, 4=discrete given # of pumps + RTU HOAs), 5=pump-down, 6=pump-down + RTU HOAs)clevel analog control level for comparison with stop/starts or the required # of pumps if using a type 3 grouppsaddr primary pump station address (0-255 = HH-WW)npumps number of pumps to control at the primary address (1-8)spump starting pump output number at the primary address (1-8)penables pump enable binary mask (0=no pumps enabled, 65535=16 pumps enabled)failsecs number of seconds to wait for a run before failing a pump (0=no fail)Optional parameters (psaddr2, npumps2, spump2 etc.) can be used to define up to 3 more pump station addresses and outputs to be controlled by the group. The maximum total number of controlled pumps is 16.The GROUP() function will return the current # of pump calls.

IF(x,y,z) If x is true evaluate y else evaluate z (else is optional). Multiple statements may be used for y or z by separating them with a colon.

Example: IF(DI1, DO1=1:DO2=1, DO1=0:DO2=0)

LABEL(x) Marks a line in the script that could be jumped to using the GOTO(x) function. This should be by itself on a line of script - see the GOTO(x) function for more info.

LISTEN(saddr, uloc, lostime [, ant#, rly1, ant1, rly2, dbrly, tbrly, pdaddr, pdoff, pdmask] ) Defines station addresses to listen for when using either Micro-Comm RTU/RTU32 (automote

messages or replies), old-style PDU messages or Modbus RTU Slave replies. When using Micro-Comm protocol, this function returns a “1” as long as the station is not in LOS. Also, the actual time in seconds since a reply was heard can be found in the station data structure.The parameters are:saddr address number (0-255 = HH-WW) or Modbus Slave address to listen foruloc starting user memory location for the station data structurelostime time in seconds before the LOS bit will be set in the station status byteant#, rly1, ant1, rly2, dbrly, tbrly - optional parameters that a central may need to talk to a non-polled remote (for remote HOA or Control Group information). These parameters are the same as shown for the MESSAGE function.pdaddr old-style PDU string address to listen for (PDU parameters are also optional)pdoffset starting location in pdu string for this station’s datapdmask data that is expected to be in the PDU string for this station (see the MPDU function)Example: X1=LISTEN(@PI,200,480)This would listen for station address “PI” and save the station data structure starting at user memory location 200. X1 will equal 1 as long as the station is not in LOS (480 seconds).Note: When using Modbus RTU Slave protocol, the reply data is just saved in a block starting at the uloc. The Modbus replies must be to “Read Holding Register” messages (4x registers).

MAVG(uloc, nwords) Returns the average value from a given range of user memory locations: uloc = the starting user memory address nwords = number of words to average

Page 37: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 37 -

MCOPY(src, dst, nwords) Copies data from one area of user memory to another using the following: src - starting user memory location for the source data dst - starting user memory location for the destination data nwords - the number of words (16bit numbers) to copy Example: To copy the first 10 words from uloc 100-109 to uloc 200-209 MCOPY(100,200,10)

MCRC(uloc, nwords) Returns the CRC 16-bit checksum of a given range of user memory locations: uloc = the starting user memory address nwords = number of words

MDATA(uloc, d1 [,d2, d3, ...]) Copies the given data words into consecutive user memory locations and returns the total number of

words copied. uloc - starting user memory location for the data d1, d2, d3, ... - data words to place into memory (can be as many as needed)

MDECTOHEX(dval, uloc, nchars) Converts an integer value to an ASCII hex string of characters located in user memory. dval - value to convert (16 bit unsigned integer) uloc - starting user memory location of the hex string nchars - number of hex characters (1-4)

MDISPLAY(row, column [,editflag]) Changes what is being displayed on the Micro-Comm Display Module by moving to the given row

and column. The “row” should be one of the following: 1=Analog Input Labels, 2=Discrete Inputs, 3=Discrete Outputs, 4=Timer Settings, 5=Stop/Starts, 6=X Variable Labels, 7=User Memory Screens.

If the optional editflag parameter is set to “1”, the displayed screen will immediately go into edit mode (just as if the user had pressed Enter).

Example: This will change the display to user memory screen #1 whenever an alarm input on DI3 goes on. The user memory screen should be set up to show an alarm message.

IF(OSR(DI3,0),MDISPLAY(7,1,0)) ‘ uses the one-shot function so that it won’t keep doing it.

MESSAGE(port, type, timeout, addr, ref, offset, npts, uloc, ant#, lostries)Modbus RTU Master Messages (type 0 and 1)

port - communications port number (1,2 or 3)type - message type (0=Modbus RTU Read, 1=Modbus RTU Write)timeout - amount of time in milliseconds the RTU will wait for a responseaddr - address of the modbus slave device (1 to 247)ref - modbus reference location in the slave to start reading or writingoffset - offset added to the reference location to start reading or writingnpts - number of data points (bits or words) to read or writeuloc - memory location for the data (User Mem 0-8999)ant# - discrete output # / mask used when transmitting (1-16, 0=none / MSB=mask for 9-16)

lostries - number of polling tries before done bit goes to 0 (returned value)

Page 38: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 38 -

MESSAGE(port, type, timeout, addr, rref, roff, rnpts, ruloc, wref, woff, wnpts, ruloc, ant#, lostries)Modbus RTU Read/Write Registers Master Message (type 27)

port - communications port numbertype - message type (27=Modbus RTU Read/Write)timeout - amount of time in milliseconds the RTU will wait for a responseaddr - address of the modbus slave device (0-255)rref - modbus holding register reference in the slave to start reading (40000-49999)roff - offset added to the reference location to start readingrnpts - number of data points (words) to readruloc - memory location for the data received (User Mem)wref - modbus holding register reference in the slave to start writing (40000-49999)woff - offset added to the reference location to start writingwnpts - number of data points (words) to writewuloc - memory location for the data to be written (User Mem)ant# - discrete output # / mask used when transmitting (1-16, 0=none / MSB=mask for 9-16)

lostries - number of polling tries before done bit goes to 0 (returned value)

MESSAGE(port, type, timeout, addr, ref, offset, nwords, uloc, ant#, lostries)DF1 Half-Duplex Master, Full-Duplex or DF1 Radio Modem Messages (types 3 - 8)

port - communications port number (1,2 or 3)type - message type (3=SLC-500 Integer File Read, 4=SLC-500 Integer File Write, 5=PLC-5 Read, 6=PLC-5 Write, 7=Unprotected Read, 8=Unprotected Write)timeout - amount of time in milliseconds the RTU will wait for a responseaddr - address of the DF1 slave device (1 to 254)ref - number and type for the file in the slave to read/write (not used for types 7 or 8)(0-255, MSB specifies a SLC file type other than integer - i.e. $8A for floating point files)offset - word number in the integer file to start reading or writingnwords - number of words to read or writeuloc- memory location for the data (User Mem 0-8999)ant# - discrete output # / mask used when transmitting (1-16, 0=none / MSB=mask for 9-16)

lostries - number of polling tries before done bit goes to 0 (returned value)

MESSAGE(port, type, timeout, saddr, ant#, rly1, ant1, rly2, dbrly, tbrly, uloc, lostries, MR, MW[,sa2, uloc2, MR2, MW2, sa3, uloc3, MR3, MW3, sa4, uloc4, MR4, MW4])Micro-Comm RTU/RTU32 Read/Write Messages (type 2, type 9 or type 24)

port - communications port numbertype - message type (2=Old-Style Control Card, 9=RTU32, 24=RTU32 w/6-bit data packing)timeout - amount of time in milliseconds the RTU will wait for a responsesaddr - address of the station being polled (0-255 where HH=0, WW=255) Note: The script compiler will convert station addresses specified by the “@” symbol followed by two letters (i.e. @WW would be compiled as 255)ant# - discrete output number to energize when transmitting (1-16, 0=none)rly1 - first choice relay station address (0-255)ant1 - antenna mask for the 1st relay station to use (0=no antenna switching)rly2- second-choice relay station & antenna (used if rly1 is in LOS)dbrly - double-bounce relay station & antenna (MSB=antenna mask,LSB=address)tbrly - triple-bounce relay station & antenna (MSB=antenna mask,LSB=address)uloc - user memory location for the station data (usually 100,200,300 etc) (the station data structure is shown in a table later in this manual)lostries - # of tries (1-255) before the LOS flag is set and the double-poll option flag (MSB=double-poll flag, LSB=# of tries - just add 256 to the # of tries to use double-poll) Note: double-poll will automatically stop after a station goes into LOS.MR - read message type (see RTU32 Protocol table)MW - write message type (see RTU32 Protocol table)[sa2, uloc2, MR2, MW2, sa3, uloc3, MR3, MW3, sa4, uloc4, MR4, MW4] optional parameters used to poll for up to 3 additional station addresses from the same RTU (available with type 9 and type 24 RTU32 messages)

Page 39: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 39 -

MESSAGE(port, type, timeout, saddr, ant#, rly1, ant1, rly2, dbrly, tbrly, uloc, ruloc, nwords, lostries)Micro-Comm RTU32 Memory Read/Write Messages (type 10 or type 11)

port - communications port numbertype - message type (10=memory read, 11=memory write)timeout - amount of time in milliseconds the RTU will wait for a responsesaddr - address of the station being polled (0-255 where HH=0, WW=255)ant# - discrete output # / mask used when transmitting (1-16, 0=none / MSB=mask for 9-16)rly1 - first choice relay station address (0-255)ant1 - antenna mask for the 1st relay station to use (0=no antenna switching)rly2 - second-choice relay station & antenna (used if rly1 is in LOS)dbrly - double-bounce relay station & antenna (MSB=antenna mask,LSB=address)tbrly - triple-bounce relay station & antenna (MSB=antenna mask,LSB=address)uloc - local user memory starting location for the data to be read or writtenruloc - remote user memory starting location for read or writenwords - number of words to read or write (1-255 words)

lostries - number of polling tries before done bit goes to 0 (returned value)

MESSAGE(port, type, timeout, saddr, ant#, rly1, ant1, rly2, dbrly, tbrly, uloc, MR)Micro-Comm RTU32/RTU Automote Messages (type 12 / 25 or type 14)

port - communications port numbertype - message type (12=RTU32 Automote, 25=RTU32 w/6bit data packing, 14=Old RTU Automote)timeout- amount of time in milliseconds the RTU will wait after transmittingsaddr - address of the station to automote (may or may not be a local station address)ant# - discrete output # / mask used when transmitting (1-16, 0=none / MSB=mask for 9-16)rly1- first relay station address (0-255)ant1 - antenna mask for the 1st relay station to use (0=no antenna switching)

rly2- optional second-choice relay station & antenna (used if rly1 is in LOS)dbrly - double-bounce relay station & antenna (MSB=antenna mask,LSB=address)tbrly - triple-bounce relay station station & antenna (MSB=antenna mask,LSB=address)uloc - user memory location for the station data (not used when the station address matches one of the RTU’s physical, RESPOND() or MESSAGE() addresses)MR - read message type to automote (see RTU32 Protocol table) Note: Station data will not be sent when it has it’s LOS bit set.

MESSAGE(port, type, timeout, ant#)Micro-Comm RTU32 Delay Message (type 13) - stops polling for a given amout of time.

port - communications port number to delay polling ontype - message type (13=delay)timeout- amount of time in milliseconds that polling will be delayed.ant# - discrete output # / mask used during the delay (1-16, 0=none / MSB=mask for 9-16)

MESSAGE(port, type, timeout, saddr, uloc, lostries)Micro-Comm CTU32 Master Message (type 15) - polls a CTU or CTU32 for station status.

port - communications port numbertype - message type (15=status update request)timeout - amount of time in milliseconds to wait for a responsesaddr - address of the station being polled (0-255 where HH=0, WW=255)uloc - user memory location for the station data (usually 100,200,300 etc.)

lostries - number of polling tries before done bit goes to 0 (returned value)

MESSAGE(port, type, timeout, saddr, ant#)Micro-Comm CTU32 Master Message (type 16) - sends a CTU32 reverse-poll status update string

port - communications port numbertype - message type (16=send status update)timeout - amount of time in milliseconds to delay before next messagesaddr - address of the station being sent (0-255 where HH=0, WW=255)ant# - discrete output # / mask used when transmitting (1-16, 0=none / MSB=mask for 9-16)

Page 40: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 40 -

MESSAGE(port, type, timeout, ant#, txuloc, txchars, rxuloc, stchar, rxchars, lostries)ASCII Message (type 17) - sends a string of ascii characters and buffers a response

port - communications port numbertype - message type (17=ascii message)timeout - amount of time in milliseconds to wait for a responseant# - discrete output # / mask used when transmitting (1-16, 0=none / MSB=mask for 9-16)txuloc - user memory start location for the transmit datatxchars- number of characters to transmitrxuloc - user memory starting location for the receive datastchar - character that marks the start of a received string (use 256 to just save all data)rxchars - maximum number of received characters to save in the memory buffer

lostries - number of polling tries before done bit goes to 0 (returned value)

MESSAGE(port, type, delay, pduaddr, ant#, rly1, ant1, rly2, dbrly, tbrly, uloc, nwords)Micro-Comm Old-Style PDU String Message (type 18)

port - communications port numbertype - message type (18=Old-Style PDU)delay - amount of time in milliseconds before going on to the next messagepduaddr - address of the PDU being polled (0-255 where HH=0, WW=255)ant# - discrete output # / mask used when transmitting (1-16, 0=none / MSB=mask for 9-16)rly1 - first choice relay station address (0-255)ant1 - antenna mask for the 1st relay station to use (0=no antenna switching)rly2- second-choice relay station & antenna (used if rly1 is in LOS)dbrly - double-bounce relay station & antenna (MSB=antenna mask,LSB=address)tbrly - triple-bounce relay station & antenna (MSB=antenna mask,LSB=address)uloc - user memory location for the start of the PDU datanwords - # of pdu data words to send (LSB of each word is sent)

MESSAGE(port, type, delay, saddr1, ant#, rly1, ant1, rly2, dbrly, tbrly, uloc, MR1, [SA2,MR2,...SA10,MR10])Micro-Comm PDU32 String Message (type 19 or 26)

port - communications port numbertype - message type (19=PDU32, 26=PDU32 w/6bit data packing)delay - amount of time in milliseconds before going on to the next messagesaddr1 - first station address being sent (0-255 where HH=0, WW=255)ant# - discrete output # / mask used when transmitting (1-16, 0=none / MSB=mask for 9-16)rly1 - first choice relay station address (0-255)ant1 - antenna mask for the 1st relay station to use (0=no antenna switching)rly2- second-choice relay station & antenna (used if rly1 is in LOS)dbrly - double-bounce relay station & antenna (MSB=antenna mask,LSB=address)tbrly - triple-bounce relay station & antenna (MSB=antenna mask,LSB=address)uloc - user memory location for station if address is not foundMR1 - first station reply type (see table)SA2, MR2 etc. - additional station addresses and reply types (up to 10 stations total)Note: Station data will not be sent when it has it’s LOS bit set.

Page 41: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 41 -

MESSAGE(port, type, timeout, saddr, ant#, rly1, ant1, rly2, dbrly, tbrly, uloc, ruloc, nwords, lostries)Micro-Comm RTU32 User Memory Setpoints Message - writes data if changed (type 20)

port - communications port numbertype - message type (20=read or write on change)timeout - amount of time in milliseconds to wait for a responsesaddr - address of the station being polled (0-255 where HH=0, WW=255)ant# - discrete output # / mask used when transmitting (1-16, 0=none / MSB=mask for 9-16)rly1 - first choice relay station address (0-255)ant1 - antenna mask for the 1st relay station to use (0=no antenna switching)rly2 - second-choice relay station & antenna (used if rly1 is in LOS)dbrly - double-bounce relay station & antenna (MSB=antenna mask,LSB=address)tbrly - triple-bounce relay station & antenna (MSB=antenna mask,LSB=address)uloc - local user memory location for the data to read / write (a write message will occur whenever a local change is made to the data block and will repeat until it is successful - normally it will just read the data from the remote)ruloc - remote user memory starting location to read / writenwords - number of words to read / write (limit 255 or 1000 for type 23)

lostries - number of polling tries before done bit goes to 0 (returned value)

MESSAGE(port, type, timeout, addr, ref, offset, nwords, uloc, ant#, lostries)Modbus RTU User Memory Setpoints Message - writes data if changed (type 21)

port - communications port numbertype - message type (21=read or write on change)timeout - amount of time in milliseconds to wait for a responseaddr - address of the station being polled ref - modbus reference location in the slave to start reading or writingoffset - offset added to the reference location to start reading or writingnwords - number of data words to read or writeuloc - local user memory location for the data to read or write (a write message will occur whenever a local change is made to the data block and will repeat until it is successful - normally it will just read the data from the remote)ant# - discrete output # / mask used when transmitting (1-16, 0=none / MSB=mask for 9-16)

lostries - number of polling tries before done bit goes to 0 (returned value)

MESSAGE(port, type, timeout, addr, ref, offset, nwords, uloc, ant#, lostries)DF1 SLC-500 User Memory Setpoints Message - writes data if changed (type 22)

port - communications port numbertype - message type (22=read or write on change)timeout - amount of time in milliseconds to wait for a responseaddr - address of the DF1 slave device (1 to 254)ref - file number for the integer file in the slave to read/writeoffset - word number in the integer file to start reading or writingnwords - number of data words to read or writeuloc - local user memory location for the data to read or write (a write message will occur whenever a local change is made to the data block and will repeat until it is successful - normally it will just read the data from the remote)ant# - discrete output # / mask used when transmitting (1-16, 0=none / MSB=mask for 9-16)

lostries - number of polling tries before done bit goes to 0 (returned value)

Page 42: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 42 -

MFILL(uloc, value, nwords) Fills data in memory given the following parameters: uloc - starting memory location for the fill value - number to fill with (16bit integer) nwords - the number of words to fill

MFCALC(oper, uloc1, uloc2, ruloc) Allows floating point math functions to be performed on user memory data (32bit floats). oper - operation to be performed (1=add, 2=subtract, 3=multiply, 4=divide, 5=raise to power) uloc1 - user memory location of the first floating point number uloc2 - user memory location of the second floating point number ruloc - user memory location for the result Examples: MFCALC(3,0,2,4) ‘M4=M0*M2 MLCALC(5,6,8,10) ‘M10=M6^M8 (raise to power)

MHEXTODEC(uloc, nchars) Convert and return the integer value of a string of ASCII hex characters located in user memory. uloc - starting user memory location of the hex string nchars - number of hex characters (1-4)

MIODONE(port, type, uloc [, value]) Returns a “1” if the specified MIOMSG is done given the port number, message type and uloc

(these 3 parameters should uniquely identify a message). It can also be used to set or clear the done status using the optional value parameter. Note: MIODONE(0,0,0) will return a “1” if all current MIOMSGs are done.

MIOMSG(port, type, timeout, addr, ref, offset, npts, uloc, lostries) Sets up a high-speed (background task) Micro-Comm I/O-Modbus RTU message loop for COM3.

Unlike normal user messages on COM3, these can have timeouts as small as 30 msec. Note: COM3 should still be set for “Micro-Comm I/O” at the master and all slaves would be set for

“Modbus RTU Slave” (Micro-Comm I/O modules are Modbus RTU Slave). Also, since this type of messaging is interrupt-driven, memory reads and writes will happen at any

time during script execution. port - communications port number (currently always 3) type - message type (0=Read, 1=Write, 21=User Memory Setpoints) timeout - amount of time in milliseconds to wait for a response addr - address of the modbus slave device (0 to 247) ref - modbus reference location in the slave to start reading or writing offset - offset added to the reference location npts - number of data points to read or write uloc - user memory location for the data lostries - number of polling tries before done bit goes to 0 (returned value) Example: X1=MIOMSG(3,0,50,0,40001,0,8,100,4) ‘reads analog input module (AI1-AI8)

MLCALC(oper, uloc1, uloc2, ruloc) Allows 32 bit math (unsigned long integer) functions to be performed on user memory data. oper - operation to be performed (1=add, 2=subtract, 3=multiply, 4=divide, 5=raise to power) uloc1 - user memory location of the first long integer uloc2 - user memory location of the second long integer ruloc - user memory location for the result Example: MLCALC(1,113,213,10) ‘M10=M113+M213

Page 43: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 43 -

MPDU(uloc, saddr, pdmask) Adds old-style PDU data to a range of user memory locations. It returns the total number of words copied to user memory. This is used in conjuction with Type 18 messages to send PDU strings. uloc - the starting user memory address saddr - station address to get the data from (0=HH - 255=WW) pdmask - bit mask with b0-b8 set based on what data is to be copied: (b0=Analog A, b1=Analog B, b2=Discretes, b3=Flow Rate, b4=IEM, b5=Pump 1-4 C/F, b6=Pump 5 C/F, b7=Analogs C,D, b8=Analogs E,F) Note: All analog data should be scaled to 8-bit.

MREAD(uloc) Returns the 16bit word stored in user memory location uloc (0-8999).

MSGDONE(port, type, uloc [, sparam]) Returns the done status for a message given the port number, message type and uloc (these 3

parameters should uniquely identify the message). If both type and uloc are zero, a value of “1” will only be returned if all messages for the given port

are done. The done bit can also be set or cleared using the optional “sparam” parameter. If the optional “sparam” parameter is 0 or 1, the done bit will be set accordingly. Other parameter

values will do the following: 2 = returns the done counter (0-65535) 3 = returns the fail counter (0-65535) 4 = returns the done percentage x 100 (0-100% = 0-10000) 5 = resets both the done and fail counters Note: Whenever the done or fail count rolls over to zero, both counters will be reset and percentage

will go to 10000. Also, done and fail counters are incremented whenever a message is successful or unsuccessful (unlike the done bit status which get’s cleared based on the message command’s “lostries” parameter).

MSGNUM(port) Returns the current user message number pending on the given communications port (1-5). The message number is it’s location in the script with relation to other messages on the same port.

Message numbering starts at “1”.

MSUM(uloc, nwords) Returns the sum of a given range of user memory locations: uloc = the starting user memory address nwords = number of words to sum

MSYNC(sync#, uloc1, uloc2, nwords) Keeps two blocks of user memory in sync. If a word in block 1 changes, block 1 will be copied to

block 2 and vice versa. The parameters are: sync# - a unique sunc function number (1-64) uloc1 - starting user memory location for block 1 uloc2 - starting user memory location for block 2 nwords - the number of words to keep in sync (block size) Note: Block 1 is the “master” so if both blocks change, block 1 will be copied to block 2. Example: MSYNC(1, 100, 200, 100) ‘keeps M100-M199 in sync with M200-M299

MWRITE(uloc, y) Writes the 16bit variable or constant y to the user memory location specified by uloc.

NVCOPY(src, dst, nwords, direction) Copies a block of data from the personality module NVRAM to User Memory or from User

Memory to NVRAM given the following parameters: src - source uloc or nvloc location depending on direction of copy dst - destination uloc or nvloc location depending on direction of copy nwords - number of 16bit words to copy direction - 0=NVRAM to User Memory, 1=User Memory to NVRAM

Page 44: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 44 -

NVREAD(nvloc) Returns a 16bit word stored in the personality module NVRAM location nvloc (0-65471)

NVWRITE(nvloc,y) Writes the 16bit variable or constant y to the personality module NVRAM location specified by nvloc (locations 0-65471 are supported)

OSR(x, osr#) One-shot rising function. This function will return a “1” only once whenever the x parameter goes from 0 to non-zero (false to true).

The osr# parameter must be a unique number (0-255) for each OSR() function used in script. Example: IF (OSR(DI1,0),X1=X1+1) ‘counts the number of times DI1 goes on...

PID(t, ai#, ao#, p, i, d, min, max, start, dband, period) Sets the parameters for a real-time PID module. Setting “ai#” to 0 disables the PID. When re-

enabled, the analog output will start again at the “start” value. A total of 8 PIDs (one for each analog output) can be running at the same time. The PID will use a scaled value for the analog input and will internally keep track of a “raw” analog output value so that it can be scaled in the script as well. The PID() function will return the “raw” analog output.

t = target setpoint (0-4095) ai# = analog input # used (1-64) ao# = analog output # used (1-8) p = proportional term x 1000 (0-65535) i = integral term x 1000 (0-65535) d = derivative term x 1000 (0-65535) min = minimum analog output (0-4095) max = maximum analog output (0-4095) start = starting value for analog output (0-4095) dband = deadband (output will hold when input is this close to the target) period = time period in seconds for the PID calculation Example: AI1=SCALE(AI1,819,3604,0,255) ‘scale AI1 300# xdcr 4-20ma => 0-255 psi PID(X1,1,1,100,10,6,0,1000,500,20,4) ‘PID using AI1,AO1 and X1 target (0-255) AO1=SCALE(AO1,0,1000,819,4095) ‘scale AO1 0-1000 => 4-20ma output

PITOAI(pi#, ai#, maxp, maxa, maxt) Sets the parameters for real-time pulse to analog conversion. pi# - pulse input # (1 - 64) ai# - analog input # (1 - 64) maxp – maximum pulses-per-sec x 100 maxa - maximum analog input reading (0 to 65535) maxt - maximum # of seconds between pulses before AI goes to zero. Example: PITOAI(1,3,1000,4095,2) This converts a pulse of 0-10pps on PI1 to a value of 0-4095 on AI3. If 2 seconds goes by without

seeing a pulse, AI3 will be set to 0.

PMEM(x) Returns a byte from the RAM copy of the personality module configuration (locations 0-127). Refer to the personality module memory map for more info. Some locations will return current status information.

POLYNOMIAL(x, xexp, c, cexp, a1, a1exp, a2, a2exp, a3, a3exp, a4, a4exp, rexp) Computes the result of a 4th degree polynomial function: f(x) = const + a1*x + a2*x^2 + a3*x^3 + a4*x^4 x = given variable x xexp = exponent multiplier for x (10^xexp) c = constant value cexp = exponent multiplier for contant (10^cexp) a1,a2,a3,a4 = polynomial parameters a1exp,a2exp,a3exp,a4exp = exponent multipliers for parameters a1-a4 (10^aexp) rexp = exponent multiplier for the return value (10^rexp) Example: M1=POLYNOMIAL(M0,0,17879,-3,-40821,-4,34023,-5,-40364,-7,14639,-9,2) This computes the following polynomial and return the result *100. f(M0) = 17.879 - 4.0821*M0 + 0.34023*M0^2 - 0.0040364*M0^3 + 0.000014639*M0^4

Page 45: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 45 -

POW(x, xexp, y, yexp, rexp) Returns the value of x raised to the y power. Pre-scaling and post-scaling is done using the given

exponent parameters. The result is rounded up to the nearest unsigned integer value. Equation used is: result = ( (x * 10^xexp) ^ (y * 10^yexp) ) * (10^rexp)

Example: X2=POW(222,-3,2,-1,4) would return a value of 7401 computed using: (0.222^0.2)*10000 = 7401

PUMPFAIL(callvar, runvar, tsec#, failsecs) Returns a “1” if the call variable has been equal to “1” for more than the fail seconds while the run

variable is zero. This fail will clear on it’s own if the run occurs at some later time. The parameter parameters are: callvar - call variable or expression (usually an output) runvar - run variable or expression (usually an input) tsec# - TSEC timer # to be used (1-224) failsecs - seconds before fail is generated Example: X1=PUMPFAIL(DO1TD,DI1,1,240)

RAMP(ramp#, startValue, endValue, rtimeSec) This will return the start value when first called and then will ramp up (or down) to the given ending

value over the given period of time (in seconds). The parameters are:ramp# a unique number for the function (1-8)startValue value to start with (when the function is first called)endValue value returned at the end of the ramp timertimeSec time period in seconds for the ramp to occurExample: AO1=RAMP(1,819,4095,120)This would ramp analog output #1 from 819 to 4095 over a 2 minute period.

RESPOND(saddr, uloc [,protocol [,nobuild] ]) Defines an additional station address for the RTU to respond as when polled with RTU32 protocol

or Modbus protocol if optional flag is set. The parameters are:saddr station address number (0-255 = HH-WW)uloc memory location for the station data structureprotocol when this optional parameter is a “1”, the given address and uloc will apply to Modbus

protocol instead of RTU32. In this case, the uloc defines a new starting location for the Holding Registers (4x0001). All other Modbus data types will remain the same.

nobuild when this optional parameter is set to “1”, the station status and timestamp will not be updated locally - this may need be used if all the station’s data is being read from another RTU using a protocol other than RTU32.

Example: RESPOND(129,3200) defines RTU32 address “PI” with station data located at 3200.

REPLYWITH(saddr, MR) Forces the reply message type to use when responding with RTU32 protocol. This could be used,

for instance, to send certain data only when necessary (report-by-exception). The parameters are:saddr station address (0-255 = HH-WW)MR read message type to reply with (see RTU32 Protocol table) - a value of 255 will cancel

the forced reply and go back to what is asked for.

RUNCOUNTER(cnum, cvar, uloc) Counts the number of “on” cycles for the given variable. The counter is incremented whenever the

value of cvar goes from zero to non-zero. The parameters are: cnum unique counter number (1-128) cvar variable or expression to count uloc user memory location used to store the counter (16 bit)

Page 46: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 46 -

RUNTIMER(tnum, tvar, uloc) Provides a run-time meter on the given variable. The run time is incremented in 10ths of hours

while the value of tvar is non-zero. The parameters are: tnum unique timer number (1-128) tvar variable or expression to time uloc user memory location used to store the timer (16 bit) - 10ths of hours

SCALE(raw, rmin, rmax, smin, smax) Returns a scaled value given the actual raw value, the minimum/maximum raw values and the

minimum/maximum scaled values. Example: AI1=SCALE(AI1,819,4095,0,4095)

SELECT(test, value1, statement1 [, value-n, statement-n]) Similar to the IF function, SELECT will evaluate the given test expression and execute one of the

statements based on it’s value. If the test expression is equal to value1, statement1 will be executed. If test is equal to value2, statement2 will be executed and so forth. Multiple statements may also be used by separating them with a colon.

Example: SELECT(X1,100,DO1=1,200,DO2=1,300,DO3=1) This will turn on a discrete output based on the value of X1.

SFTABLE(addr1, addr2, antmask, timeout) Modbus RTU, DF1 Half-Duplex and DF1 Radio Modem protocols allow for relaying messages via

the “Store & Forward” method when using COM1. A lookup table is used to translate incoming message addresses to a relayed-to station address.

The following parameters sets up an entry in the Store & Forward table: addr1 address the master is using for the remote station being relayed to addr2 address this RTU will use to get the data from the remote station antmask antenna mask used for switching radios or antennas during the relay - this is an 8-bit mask applied to either DO1-DO8 or DO9-DO16 based on the configuration selection timeout amount of time in milliseconds the RTU will wait for a response

SQR(x [, xexp, rexp]) Returns the square root of x with optional parameters for pre-scaling and post-scaling. Equation used is: result = sqrt( (x*10^xexp) ) * 10^rexp Example: X1=SQR(256,-3,4) would return a value of 5060.

SDATA(saddr, word#) Returns the value of a given word number from the “Station Data Structure” for Micro-Comm

stations obtained using the MESSAGE() or LISTEN() functions. The station data structure is shown later in this manual.

Example: X1=SDATA(@TH, 4) returns the value for AI1 from station TH.

SSTATUS(saddr, bit#) Returns the state of a given status bit number from the “Station Status” word for Micro-Comm

stations obtained using the MESSAGE() or LISTEN() functions. The following bits are defined: b7 (LOS) set when station goes into Loss of Signal (user defined) b6 (Data Valid) set when the received data is less than three cycles (tries) old b4 (Control Valid) set when data is first received and cleared at LOS

Example: X1=SSTATUS(@TH, 7) returns a “1” if station TH is in LOS.

SUB1(x)-SUB20(x) Calls a subroutine and returns the EXIT(x) value to the main script routine. Currently up to 20 subroutines are supported. Values can be passed to a subroutine using the following syntax: SUB1(x1,x2,x3,x4,x5) Where x1 through x5 are 16bit integer variables or constants passed by value to the subroutine. They become local variables referenced as L1 through L16 from within the subroutine.

Page 47: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 47 -

Example: The following shows the main script and a subroutine. The subroutine totals up the three values passed and returns the result to the main script. The main script stores the result in the

X1 variable. Main Script: X1=SUB1(1,2,3) Subroutine #1: L4=L1+L2+L3 EXIT(L4)

TCLOCK(iTime, rTime, iDay, PFRate, CLevel, CStop, OvrStop, OvrStart, uloc) This is a timeclock control function that provides for time inhibit/restore, prefill and override

setpoints. The return value and the given user memory location will have it’s bits set as follows: b0=time inhibited, b1=prefill call, b2=override call (level below the override start) The parameters are: iTime - inhibit time (military time format 0-2359) rTime - restore time iDay - inhibit day-of-week (0=every day, 1-7=Sunday-Saturday) PFRate - prefill rate in units/hour (units the same as CLevel) CLevel - control analog level CStop - normal control stop setpoint (top-off level for prefill) OvrStop - override stop setpoint OvrStart - override start setpoint uloc - user memory location to use for the inhibit and call bits

TIME(x) Returns a system time value based on the requrested parameter number. The parameters available are as follows:

0 - Seconds since power-up (rollover at 65535) 4 - Year (0-99) 1 - Day of the week (Sunday = 1) 5 - Hours (0-23) 2 - Month (1-12) 6 - Minutes (0-59) 3 - Day (1-31) 7 - Seconds (0-59 8 - Seconds since being polled by a central on COM1 - stops at 65535 secs (for central LOS) 9 - Seconds since being polled by a PC using CTU32 protocol on COM2-COM5 (for PC LOS) 10 - Seconds since polled by master on COM2, 11 - Seconds since polled by master on COM3 12 - Seconds since polled by master on COM4, 13 - Seconds since polled by master on COM5

TOTALIZE(pi#, ppc, uloc, nwords [,maxdelta]) This totalizes one of the high-speed pulse inputs given the following: pi# - pulse input register number (1-64) ppc - pulses per totalizer count uloc - user memory location for the totalizer register nwords - totalizer storage size in # of words (1 or 2) maxdelta - optional parameter to set the maximum change in pulse count that will be considered

valid (the default is 32767). This can be used to avoid problems with external pulse registers. Example: TOTALIZE(1,1200,13,2) - increments a 32bit totalizer (2 words starting at user memory

location 13), every time PI1 increases by 1200 (this could be a flow meter with 1200 pulses per 1000 gallons).

XCOPY(msrc, mdst, nwords) Copies data from one location in the RTU to another (including I/O locations) given the following: msrc - start modbus location for the source data mdst - start modbus location for the destination data nwords - the number of words (16bit values) to copy Note: msrc and mdst locations will correspond to the Modbus reference location shown in the DF1-

Modbus protocol table minus 400000. Supported memory locations include all the I/O data (1-166), X Variables (201-424) and User

Memory Locations (3000-11999). Example: To copy the first 16 discrete inputs to X2, the command is XCOPY(1,202,1)

Page 48: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 48 -

Micro-Comm Script Language - RTU Processing Flow Chart

Much like a PLC processing ladder logic, the script is executed in a continuous loop.All I/O is read and written outside of the script so all changes made to inputs or outputswill actually occur when the script finishes.

Read Inputs

(analogs, pulses, discretes)

Run Script

Write Outputs

(start timers etc.)

Respond to Interrogations

Update the User Display

General Housekeeping...

Page 49: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 49 -

DI1 DO1

Ladder LogicScript Language

Micro-Comm Script Language - Ladder Logic Comparisons

DO1=DI1&DI2DI2

DI1 DO1IF(DI1&DI2,DO1=1)

DI2L

DI1 DO1DO1=!DI1|DI2

DI2

DI1 DO1DI2DO1=!DI1&DI2

DI1 DO1IF(!DI1&!DI2,DO1=0)

DI2U

The following is a list of Script Language instructions and their corresponding Ladder Logic equivalent. The Ladder Logic shown is similar to Allen-Bradley SLC-500 instructions.

Page 50: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 50 -

Page 51: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 51 -

Personality Module Memory Map

Addr Description

0 -

1 - 0x55 - special code

2 - 0xAA - special code

3 - COM1 Parity, Data Bits (UART register)

4 - COM1 Stop Bits (UART register)

5 - COM1 PTT Delay (x10 msec increments)

6 -

7 - Station # (for DF1 or Modbus on all COMs)

8 -

9 - COM3 MCIO EDI16 Module Status Bits

10 - COM3 Baud Rate (17=19200,18=9600,19=4800,20=2400,21=1200, 22=600, 23=300, 24=110)

11 -

12 - Product ID # (17=S4500)

13 - Software Date Month (convert to Hex for display)

14 - Software Date Year (convert to Hex for display)

15 - FLASH Checksum (LSB)

16 - FLASH Checksum (MSB)

17 - BIOS Checksum (LSB)

18 - BIOS Checksum (MSB)

19 - Software Major Version Number (Ascii)

20 - Software Minor Version Number (Ascii)

21 - Software Build Version Number (Ascii)

22 - Realtime Clock - Day of Week (1-7)

23 - Realtime Clock - Month (1-12)

24 - Realtime Clock - Day (1-31)

25 - Realtime Clock - Year (0-99)

26 - Realtime Clock - Hours (0-23)

27 - Realtime Clock - Minutes (0-59)

28 - Realtime Clock - Seconds (0-59)

29 - Realtime Clock - Status (1=RTU has clock module)

30 - Pulse Input Divider MSB for PI1

31 - Pulse Input Divider LSB for PI1

32 - Primary Address (last 8 switches)

33 - Secondary Address (first 4 + last 4 switches)

34 - Pulse Input Divider MSB for PI2

35 - Pulse Input Divider LSB for PI2

36 -

37 - COM2 PTT (RTS) Delay (x10 msec increments) - defaults to 0

38 - Password Protected Flag (1=protected)

39 - COM1 Radio Modem Enable (0xA5=disabled)

40 - COM3 Mode (0=RS-232, 1=RS-485)

41 - COM3 PTT (RTS) Delay (x10 msec increments) - defaults to 0

42 - Remote Radio/Antenna Switch outputs to use (0=DO1-DO8,1=DO9-DO16)

43 - Remote Radio/Antenna Switch default output number (0-16) - 0 = none

44 - Remote Setpoints 8-bit flag (0xA5 = 8bit, otherwise 16bit) - required when using C2000 CTU

50 - COM3 Parity (Even = 0xA5, Odd = 0x5A, None=anything else)

51 - RTU32 Protocol System Code (0=none)

52 - Personality Module Configuration CRC (MSB)

53 - Personality Module Configuration CRC (LSB)

54 - Personality Module Script+Subs CRC (MSB)

55 - Personality Module Script+Subs CRC (LSB)

… (56-57 not used)

58 - RTU 1 Status - b0=LOS, b1=AUTOMOTE (1200,1380 secs), b2=OVERRIDE

60 - RTU 1 Discrete Output Byte from CTU (when polled with old RTU protocol)

74 - RTU 2 Status - b0=LOS, b1=AUTOMOTE (1200,1380 secs), b2=OVERRIDE

76 - RTU 2 Discrete Output Byte from CTU (when polled with old RTU protocol)

105 - COM3 MCIO EAI8, EAO4 and EDO16 Module Status Bits

106 - Power Fail Status (0=OK, 1=Volts<13.05 and holds for 2 min)

107 - Backup Battery Status (1=battery ok, 3=battery fail)

108 - Script Lang. Status (b0=First Pass)

109 - Script Runtime (10msec increments)

110 -

111 -

112 - Micro-Comm Display Current Column (1-??)

… (not used)

262 -

263 -

COM1 Baud Rate (204=19200,187=9600,153=4800,136=2400,102=1200, 85=600, 68=300, 51=150,

34=135, 17=110, 0=75)

COM1 Protocol (1-RTU32, 2-DF1 Slave, 3-Modbus Slave, 4-Modbus Master, 5-DF1 Master, 7-DF1 Full Duplex, 8-Modbus/TCP)

COM3 Protocol (0,1,2-MCIO,3-Modbus Slave,4-Modbus Master, 5-DF1 Master, 7-DF1 Full Duplex, 8-Modbus/TCP)

COM2 Protocol (0-None, 1-MC Display,2-DF1 Slave,3-Modbus Slave, 4=Modbus Master, 5-DF1 Master, 7-DF1 Full Duplex, 8-Modbus/TCP)

COM2 Baud Rate (CC=19200, BB=9600, 99=4800, 88=2400, 66=1200, 55=600, 44=300) - defaults to 9600 baud

CTU32 Utility Update XX Byte from SCADAview 32 (b0-b4=CTU32 Utility Switches, b5=ctu phone dialer, b6=alarm horn output, b7=ctu alarm acknowledge)

Micro-Comm Display Current Row (1=Analog Ins, 2=Discrete Ins, 3=Discrete Outs, 4=Output Timers, 5=Stop/Starts, 6=X Variables, 7=User Memory Screens)

Page 52: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 52 -

RTU32 / SCADAview 32 - Station and Group Data StructuresRTU32 / SCADAview 32 - Station and Group Data StructuresRTU32 / SCADAview 32 - Station and Group Data StructuresRTU32 / SCADAview 32 - Station and Group Data StructuresStatus UpdatesStatus Updates Command UpdatesCommand Updates Control Groups

Word #/bit Data Word #/bit Word #/bit

0/4 Control Valid (not LOS) 30 Analog Output 1 (16bit) 0/0 Alternator Forward

0/6 Valid Data (not LOS or old) 31 Analog Output 2 0/1 Alternator Reverse (00 or 11=auto)

0/7 LOS 32 Analog Output 3

33 Analog Output 4 1/0 Tower 1 Inhibit (1=inhibited)

1 Discrete Inputs 1-16 1/1 Tower 2 Inhibit

2 Expansion Inputs 1-16 34/0 RTU Override Control (1=ovr) 1/2 Tower 3 Inhibit

3 Expansion Inputs 17-32 1/3 Tower 4 Inhibit

35/0 Output 1 PC HOA HAND 1/4 Tower 5 Inhibit

4 Analog Input 1 (16bit) 35/1 Output 1 PC HOA AUTO 1/5 Tower 6 Inhibit

5 Analog Input 2 1/6 Tower 7 Inhibit

6 Analog Input 3 36/0 Output 2 PC HOA HAND 1/7 Tower 8 Inhibit

7 Analog Input 4 36/1 Output 2 PC HOA AUTO

8 Analog Input 5 2 Stop 1 Setpoint (16bit)

9 Analog Input 6 37/0 Output 3 PC HOA HAND 3 Start 1 Setpoint

10 Analog Input 7 37/1 Output 3 PC HOA AUTO 4 Stop 2 Setpoint

11 Analog Input 8 5 Start 2 Setpoint

38/0 Output 4 PC HOA HAND 6 Stop 3 Setpoint

12 Flow Rate (16bit) 38/1 Output 4 PC HOA AUTO 7 Start 3 Setpoint

13 Flow Total (msw) (0-65535) 8 Stop 4 Setpoint

14 Flow Total (lsw) (0-65535) 39/0 Output 5 PC HOA HAND 9 Start 4 Setpoint

15 Raw Pulse Counter 39/1 Output 5 PC HOA AUTO 10 Stop 5 Setpoint

11 Start 5 Setpoint

16/0 Discrete Output 1 Monitor Call 40/0 Output 6 PC HOA HAND 12 Stop 6 Setpoint

16/1 Discrete Output 1 Telemetry Call 40/1 Output 6 PC HOA AUTO 13 Start 6 Setpoint

16/2 Discrete Output 1 Run 14 Stop 7 Setpoint

16/3 Discrete Output 1 Fail 41/0 Output 7 PC HOA HAND 15 Start 7 Setpoint

16/4 Discrete Output 1 System HOA HAND 41/1 Output 7 PC HOA AUTO 16 Stop 8 Setpoint

16/5 Discrete Output 1 System HOA AUTO 17 Start 8 Setpoint

16/6 Discrete Output 1 Disabled 42/0 Output 8 PC HOA HAND

16/8 Central Sending Control Outputs 42/1 Output 8 PC HOA AUTO 18 Time Inhibit Hours 0-23

16/9 Discrete Output 1 Central Call 19 Time Inhibit Minutes 0-59

43 SCL Rate (for compatibility) 20 Time Restore Hours 0-23

17 (repeat above for discrete output 2) 44 SCL Total 21 Time Restore Minutes 0-59

18 (repeat above for discrete output 3)

19 (repeat above for discrete output 4) 22 Time Inhibit Override Stop

20 (repeat above for discrete output 5) 23 Time Inhibit Override Start

21 (repeat above for discrete output 6)

22 (repeat above for discrete output 7) 24 Time Inhibit Prefill Rate

23 (repeat above for discrete output 8)

25 Reset Control Group (1=reset)

24 Time Stamp - Hours 0-23

25 Time Stamp - Minutes 0-59 26 Time Inhibit Status (1=active)

26 Time Stamp - Seconds 0-59 27 Override Re-Enable Status (1=enabled)

27 Listen() time since last reply (secs) 28 Prefill Call Status (1=call)

28 Polling LOS Counter (# of retries) 29 Group Data Valid Flag ($5AA5)

29 Station Address (0-255)

30 Number of group calls

31 Lead pump number (0=no calls)

Station and Group Data Structure

Note: Station data for the two local addresses (RTU #1 and RTU #2) will be created in user memory starting at 8000 and 8100 whenever their address is something other than “HH”. Additional “embedded” stations can be located anywhere as specified in the RESPOND() function.

Page 53: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 53 -

LISTEN()

MESSAGE()(RTU/RTU32)

RESPOND()

Script functions can be used to build station data in 3 different ways:1) LISTEN() will passively save station data whenever it hears an RTU/RTU32 reply.2) RESPOND() will define a local station data structure and reply with the data when polled.3) MESSAGE() will actively poll a station and and save data from the reply.

Once built, SCADAview can then display and update this station data using CTU32 protocol. Command Update data (PC HOAs, etc) is obtained from the PC in this manner.

SCADAview 32

CTU32 DDE Server

RTU32 Protocol - Station Data Flow Diagram

Station Data Structure

(located in user memory)

Station Data Flow Diagram

Page 54: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 54 -

Station Address TableID # ID # ID # ID #H H 0 L H 64 P H 128 T H 192H I 1 L I 65 P I 129 T I 193H J 2 L J 66 P J 130 T J 194H K 3 L K 67 P K 131 T K 195H L 4 L L 68 P L 132 T L 196H M 5 L M 69 P M 133 T M 197H N 6 L N 70 P N 134 T N 198H O 7 L O 71 P O 135 T O 199H P 8 L P 72 P P 136 T P 200H Q 9 L Q 73 P Q 137 T Q 201H R 10 L R 74 P R 138 T R 202H S 11 L S 75 P S 139 T S 203H T 12 L T 76 P T 140 T T 204H U 13 L U 77 P U 141 T U 205H V 14 L V 78 P V 142 T V 206H W 15 L W 79 P W 143 T W 207I H 16 M H 80 Q H 144 U H 208I I 17 M I 81 Q I 145 U I 209I J 18 M J 82 Q J 146 U J 210I K 19 M K 83 Q K 147 U K 211I L 20 M L 84 Q L 148 U L 212I M 21 M M 85 Q M 149 U M 213I N 22 M N 86 Q N 150 U N 214I O 23 M O 87 Q O 151 U O 215I P 24 M P 88 Q P 152 U P 216I Q 25 M Q 89 Q Q 153 U Q 217I R 26 M R 90 Q R 154 U R 218I S 27 M S 91 Q S 155 U S 219I T 28 M T 92 Q T 156 U T 220I U 29 M U 93 Q U 157 U U 221I V 30 M V 94 Q V 158 U V 222I W 31 M W 95 Q W 159 U W 223J H 32 N H 96 R H 160 V H 224J I 33 N I 97 R I 161 V I 225J J 34 N J 98 R J 162 V J 226J K 35 N K 99 R K 163 V K 227J L 36 N L 100 R L 164 V L 228J M 37 N M 101 R M 165 V M 229J N 38 N N 102 R N 166 V N 230J O 39 N O 103 R O 167 V O 231J P 40 N P 104 R P 168 V P 232J Q 41 N Q 105 R Q 169 V Q 233J R 42 N R 106 R R 170 V R 234J S 43 N S 107 R S 171 V S 235J T 44 N T 108 R T 172 V T 236J U 45 N U 109 R U 173 V U 237J V 46 N V 110 R V 174 V V 238J W 47 N W 111 R W 175 V W 239K H 48 O H 112 S H 176 W H 240K I 49 O I 113 S I 177 W I 241K J 50 O J 114 S J 178 W J 242K K 51 O K 115 S K 179 W K 243K L 52 O L 116 S L 180 W L 244K M 53 O M 117 S M 181 W M 245K N 54 O N 118 S N 182 W N 246K O 55 O O 119 S O 183 W O 247K P 56 O P 120 S P 184 W P 248K Q 57 O Q 121 S Q 185 W Q 249K R 58 O R 122 S R 186 W R 250K S 59 O S 123 S S 187 W S 251K T 60 O T 124 S T 188 W T 252K U 61 O U 125 S U 189 W U 253K V 62 O V 126 S V 190 W V 254K W 63 O W 127 S W 191 W W 255

Page 55: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 55 -

RTU32 Protocol Message Types

Message Read Type:

MR (hex) Data Read 0 (00) none (0 chars)

1 (01) DI1-DI16,AI1-AI2 (10 chars)

2 (02) DI1-DI16,AI1-AI4 (16 chars)

3 (03) DI1-DI16,AI1-AI8 (28 chars)

4 (04) DI1-DI16,AI1-AI2,FRxx,FTxxxxxx

5 (05) DI1-DI16,AI1-AI4,FRxx,FTxxxxxx

6 (06) DI1-DI16,AI1-AI8,FRxx,FTxxxxxx

7 (07) DI1-DI16,AI1-AI2,EI1-EI32

8 (08) DI1-DI16,AI1-AI4,EI1-EI32

9 (09) DI1-DI16,AI1-AI8,EI1-EI32

10 (0A) DI1-DI16,AI1-AI2,FRxx,FTxxxxxx,EI1-EI32

11 (0B) DI1-DI16,AI1-AI4,FRxx,FTxxxxxx,EI1-EI32

12 (0C) DI1-DI16,AI1-AI8,FRxx,FTxxxxxx,EI1-EI32 (48 chars)

13 (0D) DI1-DI16,AI1-AI2,CFSYSHOA (18 chars)

14 (0E) DI1-DI16,AI1-AI4,FRxx,FTxxxxxx,CFSYSHOA (36 chars)

15 (0F) DI1-DI16,AI1-AI8,FRxx,FTxxxxxx,EI1-EI32,CFSYSHOA (56 chars)

32 (20) Smart Poll (reply will be MR types $20-$2F)

Notes: Message Read Types $01-$0F request 12 bits (3 characters) for analog inputs. 16 bit (4 character) analog inputs can be read along with the other data using types $11-$1F. Messages that include the CFSYSHOA are reading the CALL/FAIL status bits and the System

HOA/Output Disabled status for up to 8 locally-controlled discrete outputs (as defined in a GROUP function). Smart Polling with Message Read Type $20 is different in that only non-zero data groups will be included in the reply (MR types $20-$2F). All other data groups will be assumed zero and analog inputs will be the 16 bit version.

Message Write Type:

MW (hex) Data Sent 0 (00) none

1 (01) DO1-DO8

2 (02) DO1-DO8,AO1-AO2

3 (03) DO1-DO8,AO1-AO4

4 (04) AO1-AO2

5 (05) AO1-AO4

Note: Message write types $01-$05 use 12bit analog data. 16 bit analog outputs can be sent using message types $11-$15.

(when using type 9 or type 12 messages)

Page 56: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 56 -

RTU Protocol Message Types

Message Read Type:

MR (hex) Data Read 0 (00) DI1-DI6,AI1-AI6,PI,EI1-EI32 (special to match the old default)

1 (01) DI1-DI6,AI1-AI2

2 (02) DI1-DI6,AI1-AI4

3 (03) DI1-DI6,AI1-AI6

4 (04) DI1-DI6,AI1-AI2,PI

5 (05) DI1-DI6,AI1-AI4,PI

6 (06) DI1-DI6,AI1-AI6,PI

7 (07) DI1-DI6,AI1-AI2,EI1-EI32

8 (08) DI1-DI6,AI1-AI4,EI1-EI32

9 (09) DI1-DI6,AI1-AI6,EI1-EI32

10 (0A) DI1-DI6,AI1-AI2,PI,EI1-EI32

11 (0B) DI1-DI6,AI1-AI4,PI,EI1-EI32

12 (0C) DI1-DI6,AI1-AI6,PI,EI1-EI32

Message Write Type:

MW (hex) Data Sent 0 (00) DO1-DO6,AO1 (special to match the old default)

1 (01) DO1-DO6

2 (02) DO1-DO6,AO1

3 (03) DO1-DO6,AO1,AO2

4 (04) None (poll for data only)

5 (05) DO1-DO6,AO1,AO2 with Override

6 (06) DO1-DO4 with Central/Telemetry Control

7 (07) DO1-DO4,AO1 with Central/Telemetry Control

8 (08) DO1-DO4,AO1,AO2 with Central/Telemetry Control

9 (09) DO1-DO4,AO1,AO2 with Override & Central/Telemetry Control

Note: Message Write types 6 - 9 that include Central/Telemetry Control will do 2 things:

1) Central Control output #5 will always be turned on in the outgoing message.

2) Telemetry Control output #6 will be turned on only if PC HOA #6 is in HAND or AUTO.

(when using type 2 or type 14 messages)

Page 57: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 57 -

Control Group Flowchart

Stop/Start Setpoints

Analog Level

Pump Enables

Group Enable

Compare the given analog level with up to 8 stop/start setpoints for the given total # of pumps and generate "n"

group pump calls.

Any Pumps Called Before Now?

No

Alternate by moving the lead pump pointer to the next available pump in the list.

Yes

Call on (n-N) additional pumps starting at the lead pump pointer and skipping over any pumps that are not available or are already being called.

Build list of available pumps (HOAs in auto, not failed, not disabled) - a zero for Group Enable or Time Clock reaching

the disable time will disable all pumps and trigger automatic alternation.

Too Many Pumps Called? (N>n)

Count the number of pumps "N" that are in AUTO and are already being called.

No

Call off (N-n) pumps starting after the first n pumps that were being called and are in AUTO.

Yes

Group already satified? (N=n)

Yes

All Done -Telemetry Call bits will now be set in station data structure for all pumps called.

No

Control Group Function Block Flowchart(type 1: analog level pump-up using PC HOAs and AUTO alternation)

Total # of pumps, pump station addresses, starting pumps, PC

HOA positions, fail bits etc.

Is Lead Pump Still Available?

No

Yes

If fail time is non-zero, check the time since pumps were called and set fail bits if

necessary.

(Type 1 - Analog Level Pump-Up with PC HOAs and AUTO Alternation)

Page 58: S4500 PLC User’s Reference Manual - Micro-Comm, Inc User's Referen… ·  · 2007-09-28User’s Reference Manual Revised: September 28, ... 5 Sample Wiring ... Expansion I/O Module

- 58 -

Message Type TableUser Message Types

Type Description and Parameters

0 Modbus RTU Read

port, type, timeout, addr, ref, offset, npts, uloc, ant#

1 Modbus RTU Write

port, type, timeout, addr, ref, offset, npts, uloc, ant#

2 Micro-Comm RTU (old-style control card)

port, type, timeout, saddr, ant#, rly1, ant1, rly2, dbrly, tbrly, uloc, lostries, MR, MW

3 DF1 SLC-500 File Read

port, type, timeout, addr, ref, offset, nwords, uloc, ant#

4 DF1 SLC-500 File Write

port, type, timeout, addr, ref, offset, nwords, uloc, ant#, lostries

5 DF1 PLC-5 Read

port, type, timeout, addr, ref, offset, nwords, uloc, ant#, lostries

6 DF1 PLC-5 Write

port, type, timeout, addr, ref, offset, nwords, uloc, ant#, lostries

7 DF1 Unprotected Read

port, type, timeout, addr, ref, offset, nwords, uloc, ant#, lostries

8 DF1 Unprotected Write

port, type, timeout, addr, ref, offset, nwords, uloc, ant#, lostries

9 Micro-Comm RTU32

port, type, timeout, saddr, ant#, rly1, ant1, rly2, dbrly, tbrly, uloc, lostries, MR, MW

10 Micro-Comm RTU32 User Memory Read

port, type, timeout, saddr, ant#, rly1, ant1, rly2, dbrly, tbrly, uloc, ruloc, nwords, lostries

11 Micro-Comm RTU32 User Memory Write

port, type, timeout, saddr, ant#, rly1, ant1, rly2, dbrly, tbrly, uloc, ruloc, nwords, lostries

12 Micro-Comm RTU Automote (old-style control card)

port, type, delay, saddr, ant#, rly1, ant1, rly2, dbrly, tbrly, uloc, MR

13 Delay Polling (on a given port)

port, type, delay, ant#

14 Micro-Comm RTU32 Automote

port, type, delay, saddr, ant#, rly1, ant1, rly2, dbrly, tbrly, uloc, MR

15 Micro-Comm CTU32 Status Update Request

port, type, timeout, saddr, uloc, lostries

16 Micro-Comm CTU32 Reverse Poll

port, type, delay, saddr, ant#

17 ASCII Message

port, type, timeout, ant#, txuloc, txchars, rxuloc, stchar, rxchars

18 Micro-Comm PDU (old-style)

port, type, delay, pduaddr, ant#, rly1, ant1, rly2, dbrly, tbrly, uloc, nwords

19 Micro-Comm PDU32

port, type, delay, SA1, ant#, rly1, ant1, rly2, dbrly, tbrly, uloc, MR1, [SA2,MR2,...SA10,MR10]

20 Micro-Comm RTU32 User Memory Setpoints

port, type, timeout, saddr, ant#, rly1, ant1, rly2, dbrly, tbrly, uloc, ruloc, nwords, lostries

21 Modbus RTU User Memory Setpoints

port, type, timeout, addr, ref, offset, nwords, uloc, ant#, lostries

22 DF1 SLC-500 User Memory Setpoints

port, type, timeout, addr, ref, offset, nwords, uloc, ant#, lostries

23 Micro-Comm RTU32 User Memory Setpoints (zero-compressed)

port, type, timeout, saddr, ant#, rly1, ant1, rly2, dbrly, tbrly, uloc, ruloc, nwords, lostries

24 Micro-Comm RTU32 with 6bit/char packed data (more efficient)

port, type, timeout, saddr, ant#, rly1, ant1, rly2, dbrly, tbrly, uloc, lostries, MR, MW

25 Micro-Comm RTU32 Automote with 6bit/char packed data

port, type, delay, saddr, ant#, rly1, ant1, rly2, dbrly, tbrly, uloc, MR

26 Micro-Comm PDU32 with 6bit/char packed data

port, type, delay, SA1, ant#, rly1, ant1, rly2, dbrly, tbrly, uloc, MR1, [SA2,MR2,...SA10,MR10]

27 Modbus RTU Read/Write Registers

port, type, timeout, addr, rref, roff, rnpts, ruloc, wref, woff, wnpts, wuloc, ant#, lostries