Welcome to the Industrial Automation website!

NameDescriptionContent
XING-Automation
E-mail  
Password  
  
Forgot password?
  Register
当前位置:

Deep Analysis and Industrial Control Application of Reliance DCS 5000 Enhanced BASIC Language

F: | Au:FAN | DA:2026-02-05 | 810 Br: | 🔊 点击朗读正文 ❚❚ ▶ | Share:

1. Configuration Task

This is the 'blueprint' of the system, which must be loaded before any application task to define global resources and hardware mappings, and it does not execute itself. The key statements include:

TASK: Define the names, types, CPU slots, and priorities (4-11) of all tasks (BASIC, PC, or control block tasks) in the system.

MEMDEF/NVMEMDEF: Define global variables (COMMON variables) that can be accessed by all tasks inside the chassis. The variables defined by NVMEMDEF can maintain their values after power failure and restart, and are suitable for process parameters that require persistence.

IODEF/NETDEF/RIODEF/MODDEF/RNETDEF/ABDEF: This series of "DEF" statements is used to map physical I/O addresses (local, remote, network, Modbus, AutoMate, Allen Bradley, etc.) to symbolic variable names, achieving software and hardware decoupling.

2. Application Task

This is the main body of the program that implements specific control logic. All variables must be defined before use:

LOCAL: Define local variables that are only used within this task, including simple variables, arrays, and adjustable variables. Adjustable variables allow operators to adjust parameters (such as PID gain) within a preset range (HIGH/LOW) at a specified step size (STEP) through the terminal during runtime, but the program can only read its value, enhancing the flexibility and safety of the system.

COMMON: Declare the global variables defined in the configuration task that will be used for this task.

3. Process control and subroutines

GOTO/ON GOTO: Implement unconditional or integer expression based conditional jumps.

GOSUB/ON GOSUB/RETURN: Used to call subroutines, supports nesting.

IF-THEN: Conditional judgment and execution based on Boolean expressions.

FOR-NEXT: Build a counting loop that supports nesting and stride (STEP) settings.

4. Program documentation

Support REM (compile time discard) and! Two formats of comment statements are available for easy code maintenance, which can be downloaded with the task and uploaded for viewing.


Advanced enhancements: multitasking, real-time, and I/O

1. Multi task enhancement

The system decomposes different control functions into independent tasks and achieves "concurrent" execution through priority scheduling. The key synchronization mechanisms include:

EVENT: Define software or hardware events. Hardware events can be associated with the interrupt status register of a specific I/O card and timeout protection can be set.

SET/WAIT: One task triggers an event with SET, and another or more tasks wait for the event with WAIT ON to achieve synchronization and communication between tasks.

OPEN CHANNEL: Establish a typed (I-integer, D-double integer, R-real, S-string, B-boolean) data channel between two tasks. The task reads and writes data to the channel through PRINCT # and INPUT #. If the channel is full/empty, the task is suspended, naturally achieving synchronization in the producer consumer mode.

2. Real time enhancement

DELAY: Suspend the task for a specified time (unit: TICKS [5.5 milliseconds] SECONDS、MINUTES、HOURS)。

START EVERY: Set the periodic execution of tasks. After the task is executed to the END statement, it sleeps and is reactivated by the operating system after the specified cycle. It starts executing from the START statement and is suitable for implementing a fixed speed control scan loop.

3. Powerful I/O capability

OPEN/CLOSE: Allocate and release logical devices (such as serial port PORTA).

INPUT/PRIMT: Read data from or output data to a device. PRIMT USING supports rich formatted outputs (left/right/center alignment, leading zeros, decimal control).

GET/PUT: Perform single character input/output.

Read/DATA/STORE: Read preset values from the internal data area of the program, which is more efficient than INPUT.

IOWRITE statement and IOREAD% function: designed specifically for accessing "peripheral" I/O cards that do not comply with DCS standards (such as byte only access or write only), allowing direct read and write operations to specific hexadecimal addresses, providing maximum hardware access flexibility.


Rich built-in function library

The function library covers mathematical operations, string processing, bit operations, BCD code conversion, screen control (VT100 terminal), and system level operations:

Mathematical functions: SIN, COS, TAN, ATN, LN, EXP, SQRT, ABS, etc.

String functions: CHR $, ASC%, LEN%, STR $, LEFT $, RIGHT $, MID $, VAL%, VAL, etc.

Bit and logic functions: BIT_SET @, BIT_CR @, BITVNet @, SHIFTL%, SHIFTR%, ROTATEL%, ROTATER%.

Industrial application functions: BCD_OUT%, BCD_IN% are used for data conversion of digital tubes or dip switches; BLOCKVNet @ is used for batch data transfer between variables and network I/O; GATEWAY_CMD-OK @ with VARPTR! Implement batch reading and writing of registers through gateways such as Modbus.


Error handling and system robustness

ON ERROR GOTO/RESUME: Allow programs to define runtime error handling routines. The predefined variables ERR% and ERL% provide error codes and error line numbers, respectively.

Error log: All non fatal errors are recorded in the task error log for easy diagnosis.

  • National Instruments cDAQ-9189 Chassis
  • National Instruments PXIe-8394 MXI Module
  • National Instruments PXIe-4112 Power Supply
  • National Instruments 778472-01 Module
  • National Instruments cFP-DO-401 Module
  • National Instruments PXIe-8379 Interface Card
  • National Instruments PXIe-7965R Module
  • National Instruments NI-9485 Relay Module
  • National Instruments 181045-01 Module
  • National Instruments TB-4302 Terminal Block
  • National Instruments PXI-2533 Matrix Switch Module
  • National Instruments PCI-6220 Analog Input Card
  • National Instruments PXI-2529 Matrix Switch Module
  • National Instruments 783732-01 Ordering Part Number
  • National Instruments PXI-6542 Digital Waveform Module
  • National Instruments PCI-1411 Image Acquisition Card
  • National Instruments PXI-6511 Industrial Digital I/O Module
  • National Instruments TPC-2012 Touch Panel Computer
  • National Instruments PXI-8101 Embedded Controller
  • National Instruments cRIO-9035 CompactRIO Controller
  • National Instruments PXIe-5114 Digitizer Card
  • National Instruments SCXI-1315 Block
  • National Instruments PXI-7842R Card
  • National Instruments PCI-6031E DAQ Device
  • National Instruments NI-9792 Gateway
  • National Instruments PXI-4132 SMU
  • National Instruments USB-5132 Digitizer
  • National Instruments NI 9244 Input Module
  • National Instruments SCXI-1163R Module
  • National Instruments PCI-6221 DAQ Device
  • National Instruments cFP-2120 Compact FieldPoint Controller
  • National Instruments cRIO-9073 CompactRIO Controller
  • National Instruments PCI-8516 CAN Interface Card
  • National Instruments PXIe-1073 5-Slot Chassis
  • National Instruments NI 9421 DSUB Digital Input Module
  • National Instruments PXI-4204 High Voltage Input Module
  • National Instruments PCI-6111 Multifunction DAQ Card
  • National Instruments cRIO-9035 CompactRIO Controller
  • National Instruments NI 9759 Powertrain Control Module
  • National Instruments 187254A-01 Ordering Part Number
  • National Instruments PXI-6624 Module
  • National Instruments cDAQ-9137 Chassis
  • National Instruments PXIe-8133 Controller
  • National Instruments 779139-01 Module
  • National Instruments FP-DI-301 Module
  • National Instruments 194021D-01L Module
  • National Instruments PXI-1000B Chassis
  • National Instruments PXIe-8510 Module
  • National Instruments PXI-6221 DAQ Card
  • National Instruments cDAQ-9188 Chassis
  • National Instruments PXI-5421 Arbitrary Waveform Generator
  • National Instruments cRIO-9023 CompactRIO Controller
  • National Instruments PCI-6221 Multifunction DAQ Card
  • National Instruments PXI-4065 Digital Multimeter Card
  • National Instruments NI 9477 Digital Output Module
  • National Instruments cDAQ-9185 TSN Ethernet Chassis
  • National Instruments NI 9147 4-Slot cRIO Chassis
  • National Instruments USB-6259 Mass Termination DAQ Device
  • National Instruments 184120F-01 Ordering Part Number
  • National Instruments PCI-4472B Sound and Vibration Module
  • National Instruments SCXI-1130 Switch
  • National Instruments VB-8012 VirtualBench
  • National Instruments PXI-7350 Controller
  • National Instruments eDAQ-9174 Chassis
  • National Instruments PXI-4461 DSA Module
  • National Instruments PCI-6280 DAQ Card
  • National Instruments PXI-6251 DAQ Card
  • National Instruments PXI-6653 Module
  • National Instruments PCI-6509 DIO Device
  • National Instruments NI 9751 Driver Module
  • National Instruments PXIe-6361 Multifunction I/O Module
  • National Instruments cRIO-9014 CompactRIO Controller
  • National Instruments PCI-7390 Motion Control Card
  • National Instruments PXI-8512 CAN Interface Module
  • National Instruments sbRIO-9636 Single-Board Controller
  • National Instruments IC-3120 Industrial Controller
  • National Instruments PCI-6220 M Series DAQ Card
  • National Instruments PXI-8176 Embedded Controller
  • National Instruments PXI-6132 S Series DAQ Module
  • National Instruments NI 9206 Analog Input Module
  • National Instruments PXI-2584 Switch Module
  • National Instruments 196541B-01L Module
  • National Instruments 778075-01 Module
  • National Instruments FP-RLY-420 Module
  • National Instruments USRP-2920 Radio
  • National Instruments PCIe-6351 DAQ Card
  • National Instruments cRIO-9040 Controller
  • National Instruments NI 9201 Input Module
  • National Instruments NI 9411 Input Module
  • National Instruments NI 9216 Input Module
  • National Instruments PCI-6221 DAQ Device
  • National Instruments PXI-4498 DSA Module
  • National Instruments PXI-6259 DAQ Card
  • National Instruments PXI-7354 Motion Controller
  • National Instruments FP-AI-110 Input Module
  • National Instruments 192172F-04L Module
  • National Instruments PXIe-8115 Controller
  • National Instruments 142931B-01L Module
  • National Instruments PXI-2503 Switch Module
  • National Instruments 776246-01 Module
  • National Instruments CFP-2110 Compact FieldPoint Controller
  • National Instruments 779429-01 Ordering Part Number
  • National Instruments NI-9149 8-Slot EtherCAT Chassis
  • National Instruments PXI-4110 Programmable DC Supply
  • National Instruments 192061-10 Ordering Part Number
  • National Instruments cDAQ-9181 Chassis Module Carrier
  • National Instruments NI 9437 Digital Input Module
  • National Instruments cFP-2020 Compact FieldPoint Controller
  • National Instruments PCI-6259 Multifunction DAQ Card
  • National Instruments FP-TC-120 Thermocouple Module
  • National Instruments NI-9174 CompactDAQ Chassis
  • National Instruments PXI-6030E DAQ Module
  • National Instruments PXIe-5160 Oscilloscope
  • National Instruments PXI-4462 DSA Module
  • National Instruments PXI-8109 Controller
  • National Instruments PXI-6259 DAQ Card
  • National Instruments PXI-6030E DAQ Card
  • National Instruments cRIO-9056 Controller
  • National Instruments PXIe-8370 MXI Kit
  • National Instruments USB-6212 DAQ Device
  • National Instruments RMX-4000 Electronic Load System
  • National Instruments 785040-01 Ordering Part Number
  • National Instruments cFP-AI-110 Analog Input Module
  • National Instruments cDAQ-9189 8-Slot Chassis
  • National Instruments PXIe-4139 Source Measure Unit
  • National Instruments PXI-5620 Digitizer Module
  • National Instruments PCIe-8371 MXI-Express Card
  • National Instruments 196762B-01L Ordering Part Number