MC-Basic:SYSTEM.DOUT
Language: | English • 中文(简体) |
---|
SYSTEM.DOUT it's a command that read or write an outputs in users system.
When SYSTEM.DOUT is qualified by a bit number, only that output bit is written. When SYSTEM.DOUT is queried, the value returned corresponds to the current state of the digital outputs.
When SYSTEM.DOUT is qualified by a range of bit numbers (through the double-index format), only those output bits are written.
When working in EtherCAT or CANopen systems, the slaves I/O's mapped to softMC by softMC Configurator. Users can read or write outputs status with the following syntax:
--> ?sys.dout.3001 ' querying slave number 3, bit number 1 status.
--> sys.dout.2004 = 1 ' determined slave number 2, bit number 4 value.
By default the first 23 outputs are mapped by softMC, which their value sets to 0. These outputs made to support legacy applications, and wont be transferred to any hardware.
Users can read or write these outputs with the following syntax:
?sys.dout.1 ' querying softMC bit number 1 status.
sys.dout.14 = 1 ' determined softMC bit number 14 value.
In case users want to use more bits then mapped - they should defined the wanted bits using softMC Configurator, in the digital IO's setting window for the relevant slave:
Syntax
System.Dout
Sys.Dout
System.Dout = <value>
System.Dout.<bit number> = <value> 'bit number can set also the specific bit at the specific slave.
System.Dout[<bit number>] = <value>
System.Dout[<bit number>][<range>] = <value>
?System.Dout
?System.Dout.<bit number>
?System.Dout[<bit number>]
? System.Dout[<bit number>][<range>]
Availability
All versions
Type
A query returns a Double value.
Range
Decimal: 0 to 8 388 607 (223 –1)
Hex: 0x0 to 0x7FFFFF
Number of default mapped bits on softMC: 1 to 23
When working with slaves:
- Syntax - sys.dout.<ijkl>
- i - Stands for slave number at EtharCAT/CANopen chain.
- j,k,l - Stands for bit number at slave.
Scope
Configuration, Task or Terminal
Limitations
When setting outputs, the property takes only a Long value.
Examples
System.DOut = MyVar ‘MyVar is written to the output word.
System.DOut.3 = MyVar ‘MyVar’ is written to output bit number 3. ‘MyVar’ must have a value of only 0 or 1.
System.Dout[3] = MyVar ‘MyVar’ is written to output bit number 3. ‘MyVar’ must have a value of only 0 or 1.
?System.DOut.3 ‘Print the value of output bit number 3
?System.Dout[3] ‘Print the value of output bit number 3
System.Dout[3][4] = MyVar ‘MyVar’ is written to output bits 3, 4,5 and 6.
?System.Dout[3][4] ‘Print the values of output bits 3, 4, 5 and 6.
?System.Dout[3001][4] ‘Print the values of output bits 1, 2, 3 and 4 of slave number 3
?System.Dout.4001 ‘Print the value of output bit number 1 of slave number 4