Mitsubishi MELFA CR1D Instruction Manual page 199

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, and M_Inw and
M_Outw are used in the case of 16-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
Designate the variable name.
Designate BIT(1bit), BYTE(8bit), WORD(16bit) or INTEGER.
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.
[, <Mask information>]
Detailed explanation of command words 4-186
4MELFA-BASIC IV

Advertisement

Table of Contents
loading

This manual is also suitable for:

Melfa cr2dMelfa cr3d

Table of Contents