Download MasterTool Programming, PONTO Series Programming

Transcript
Chapter 5
Function Modules
%MXXXX - Number of field from/to which the data will be copied (parameter
3). Should contain between 0 and the total number of fields less 1.
%KM+XXXXX - Total number of registers (1 to 255) required for the file
(parameter 4).
%KM+XXXXX - Total number of fields (1 to 255) required for the file
(parameter 5).
•
OPER4 – Not used.
Inputs and Outputs
Description of the inputs:
•
enable - when this input is powered the function is called, the parameters programmed in the
CHF instruction being analyzed. If the number of parameters or their type are different from the
needs of the module, the error output is powered. If they are correct a attempt to access the file is
carried out.
•
read/write - when powered, the value of the first parameter is copied to the register and the
field specified in the second and third parameters. If it is turned off, the value is read from the
field and copied to the first parameter.
Description of the outputs:
•
•
success - indicates that the access to the data file was correctly carried out.
invalid index - this output is connected:
the field to be read or written was not specified
the declaration of the registers and fields exceeds the modules memory capacity
there is an attempt to read when the first parameter is a constant
there is an attempt to write the module being stored in EPROM memory
•
error - is powered if an error occurs in the specification of the parameters or attempt to access
the operands not declared.
Description of Functioning
For correct declaration of the number of fields and registers of the file, the following calculation
should be carried out:
Occupation of the file = Num. registers X Num. fields X Num. bytes per field
(parameter 5)
(parameter 4)
The number of bytes per field occupied for each type of operand can be obtained from table 4-2.
Parameter 1
%MXXXX
%DXXXX
%AXXXX
%EXXXX
%SXXXX
%TMXXXX
%TDXXXX
%KM+XXXXX
%KD+XXXXXXX
Number of bytes per
field
2
4
1
1
1
2
4
2
4
Table 4-2 Occupation of the Field of the Files
The value obtained in the previous calculation should be less than or equal to the total capacity of the
function used, according to table 4-3.
133