MITSUBISHI ELECTRIC T-60 User Manual

Page 85

Advertising
background image

Examples:

10 DIM regdat%(10)

20 CALL PLCREAD(1,4,16,,5,regdat%(4))

This command returns the contents of element 16 in regdat%(4), element 17

in regdat%(5), element 18 in regdat%(6), element 19 in regdat%(7), element

20 in regdat%(8), from file #4 in the PLC-5 with id #1.

10 CALL PLCREAD(2,5,47,,1,regdat1%)

This command reads the data in input element number 47 in file #5 in the
PLC-5 with id (address) = 2 and stores it in the variable regdat1%

10 DIM stat%(2)

20 CALL PLCREAD(1,1,1,15,18,stat%(1))

This command would access file 1 in the PLC with an id of 1. It would return

the status of address 1, bit 15, and address 2, bits 0-14 in stat%(1) and the
status of address 2, bit 15 and address 3 bit 0 (and 14 zeros) in stat%(2).

CALL PLCWRITE Statement

Syntax:

CALL PLCWRITE(id, file, address, [bit], count, variable/array )

Comments:

This command is specific to the -PL5 Interface Option.

id

specifies the address of the PLC in which you wish to write data. This

number is usually 1 when interfacing to one PLC.

file

specifies the file number that you wish to write to.

address

is the address of the first element to write to in the above file.

[bit]

is an optional parameter which specifies the starting bit location of the

bits you wish to write. If you are writing words (as in writing a
register value), leave this field blank (i.e., ...
address,,count,...). If you

are writing bits (I/O points, internal coils, etc.) specify the starting bit in the
element you are addressing (address) . This could be any bit from 0-15.

count

specifies the number of bits and/or elements that you wish to set. If

you are writing data in the form of words, it is the number of consecutive
elements you wish to write. If you are setting bits, it is the number of

consecutive bits you wish to set.

variable/array

is the variable name or single dimension array name where

you wish to store the data you are writing. If the value of count (see above) is
1, this could be a variable expression. If you are writing elements that are

stored as words and count is greater than one, this will be an array (make

PLC Interface Commands PLC Specific Information

77

Advertising