Mitsubishi Electric CR750-Q Instruction Manual page 227

Cr750/cr751/cr760 series
Hide thumbs Also See for CR750-Q:
Table of Contents

Advertisement

Def IO (Define IO)
[Function]
Declares an input/output variable. Use this instruction to specify bit widths. M_In and M_Out variables are
used for normal single-bit signals, M_Inb and M_Outb are used in the case of 8-bit bytes, M_Inw and
M_Outw are used in the case of 16-bit words, and M_In32, M_Out32 are used in the case of 32-bit words.
Be aware that it is not allowed to reference output signals with variables declared using this instruction.
[Format]
Def[]IO[]<Input/output variable name> = <Type designation>, <Input/output bit No.>
[Terminology]
<Input/output variable name>
<Type designation>
<Input/output bit No.>
<Mask information>
[Reference Program]
(1) Assign the input variable named PORT1 to input/output signal number 6 in bit type.
1 Def IO PORT1 = Bit,6
:
10 PORT1 = 1
:
20 PORT1 = 2
21 M1 = PORT1
(2) Assign the input variable named PORT2 to input/output signal number 5 in byte type, and specify the
mask information as 0F in hexadecimal.
1 Def IO PORT2 = Byte, 5, &H0F
:
10 PORT2 = &HFF
:
20 M2 = PORT2
(3) Assign the input variable named PORT3 to input/output signal number 8 in word type, and specify the
mask information as 0FFF in hexadecimal.
1 Def IO PORT3 = Word, 8, &H0FFF
:
10 PORT3 = 9
:
20 M3 = PORT3
(4) Assign the input variable named PORT4 to input/output signal number 16 in dword type, and specify the
mask information as 3FFFFF in hexadecimal.
1 Def IO PORT4 = DWord, 16, &H3FFFFF
:
10 PORT4 = 65536
Designate the variable name.
Designate Bit(1bit), Byte(8bit), Word(16bit) or DWord(32bit).
Designate the input (when referencing) or output (when assigning) bit No.
Designate when only a specific signal is to be validated.
' Output signal number 6 turns on.
' Output signal number 6 turns off.(Because the lowest bit of the numerical value 2 is
0.)
' Substitute the state of the input signal number 6 for M11.
' Output signal number 5 to 8 turns on.
' Substitute the value of the input signals 5 to 8 for the variable M2.
' Output signal number 8 and 11 turns on.
' Substitute the value of the input signals 8 to 19 for the variable
M3.
' Output signal number 48 turns on.
[, <Mask information>]
Detailed explanation of command words 4-207
4MELFA-BASIC V

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cr750Cr751-qCr751-dCr760-dCr760-qCr750-d

Table of Contents