Difference between revisions of "MC-Basic:SYSTEM.DIPSWITCH"
(Described simulated DIP switch and Inputs) |
|||
(6 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{Languages|MC-Basic:SYSTEM.DIPSWITCH}} | ||
{{MC-Basic | {{MC-Basic | ||
|SHORT FORM= | |SHORT FORM= | ||
Line 4: | Line 5: | ||
|SYNTAX= | |SYNTAX= | ||
− | System.DipSwitch{.'' | + | System.DipSwitch{.<''bit number''>}<br> |
− | Sys.DipSwitch{.'' | + | Sys.DipSwitch{.<''bit number''>}<br> |
− | ?System.DipSwitch{.'' | + | ?System.DipSwitch{.<''bit number''>}<br> |
− | ?Sys.DipSwitch{.'' | + | ?Sys.DipSwitch{.<''bit number''>} |
|AVAILABILITY= | |AVAILABILITY= | ||
− | + | Since version 4.11.1 | |
|DESCRIPTION= | |DESCRIPTION= | ||
− | SYSTEM.DIPSWITCH reads a value of simulated DIP-Switch from file IO.DAT. It contains the values of the individual bits in the DIPswitch byte. If SYSTEM.DIPSWITCH is qualified by a bit number, only that input bit is read. SYSTEM.DIPSWITCH.<bit_number> returns the value 1 or 0, depending on the setting of the switch. | + | SYSTEM.DIPSWITCH reads a value of simulated DIP-Switch from file IO.DAT, from field "DIP". It contains the values of the individual bits in the DIPswitch byte. If SYSTEM.DIPSWITCH is qualified by a bit number, only that input bit is read. SYSTEM.DIPSWITCH.<bit_number> returns the value 1 or 0, depending on the setting of the switch. |
<br>File IO.DAT is generated '''automatically''' if it does not exist on the flash disk. | <br>File IO.DAT is generated '''automatically''' if it does not exist on the flash disk. | ||
<br>''Format of IO.DAT'' | <br>''Format of IO.DAT'' | ||
− | <br>DIP= | + | <br>DIP=0xXX |
− | <br>INP= | + | <br>INP=0xXX |
Value of simulated DIP-Switch is read via SYSTEM.DIN | Value of simulated DIP-Switch is read via SYSTEM.DIN | ||
Line 33: | Line 34: | ||
|TYPE= | |TYPE= | ||
− | '' | + | <''bit number''>: Long<br> |
Value: Long | Value: Long | ||
|RANGE= | |RANGE= | ||
− | '' | + | <''bit number''>: 1 to 8<br> |
Value: 0 to 255 (0xFF) | Value: 0 to 255 (0xFF) | ||
Line 66: | Line 67: | ||
+ | [[Category:MC-Basic:System|MC-Basic:System]] | ||
}} | }} |
Latest revision as of 02:07, 2 May 2017
Language: | English • 中文(简体) |
---|
SYSTEM.DIPSWITCH reads a value of simulated DIP-Switch from file IO.DAT, from field "DIP". It contains the values of the individual bits in the DIPswitch byte. If SYSTEM.DIPSWITCH is qualified by a bit number, only that input bit is read. SYSTEM.DIPSWITCH.<bit_number> returns the value 1 or 0, depending on the setting of the switch.
File IO.DAT is generated automatically if it does not exist on the flash disk.
Format of IO.DAT
DIP=0xXX
INP=0xXX
Value of simulated DIP-Switch is read via SYSTEM.DIN Value of simulated Inputs is read via SYSTEM.DIN.1 trough SYSTEM.DIN.23
Bit # 6 directs the system not to load the Config.prg file during system startup.
0= Config.prg and Autoexec.prg are not loaded.
1 = Config.prg and Autoexec.prg are loaded. Default value should be 1 during normal operation.
Other bits reserved for system use.
Syntax
System.DipSwitch{.<bit number>}
Sys.DipSwitch{.<bit number>}
?System.DipSwitch{.<bit number>}
?Sys.DipSwitch{.<bit number>}
Availability
Since version 4.11.1
Type
<bit number>: Long
Value: Long
Range
<bit number>: 1 to 8
Value: 0 to 255 (0xFF)
Default
See description.
Scope
Configuration, Task or Terminal
Limitations
Read only
Examples
MyVar = System.DipSwitch
'MyVar is assigned the value of the input word
MyVar = System.DipSwitch.1
'MyVar is assigned 0 or 1, according to the value of the switch