Function block FB_KM6551_SLAVEBROADCAST_10BYTE
This function block takes care of communication to the broadcast slave module. Only one function block can be called per slave. A positive edge on bStart activates communication to the slave. If bError is FALSE, then communication was successful and the input data is valid. If the bError bit is TRUE, an error has occurred. A precise error cause can be read out in iErrorID. ptData_IN is a pointer address for the input data (ADR command to determine the pointer address) and iLenData_IN is the length of the data. The length can be determined with SIZEOF and must not be larger than 10 bytes. The same applies to the output data. The strLinkData variable is linked to the FB_KM6551_MAIN function block (the variable has exactly the same name). The FB_KM6551_MAIN function block should be finished before the FB_KM6551_MASTER_10BYTE function block is called, (see bActive in this function block).
VAR_INPUT
bStart
:BOOL;
strLinkData
:KM6551_Data;
ptData_IN
:DWORD;
iLenData_IN :INT;
Key
bStart: A positive edge activates the function block.
strLinkData: Is linked with strLinkData from FB_KM6551_MAIN.
ptData_IN: Pointer to the variable into which the device data should be copied (pointer address is determined with ADR(Variable_name)).
iLenData_IN: Length of the variable (the length can be determined with SIZEOF (variable_name))
VAR_OUTPUT
bError
:BOOL;
bActive
:BOOL;
iErrorID
:E_KM6551_ERRORID;
iSignalQuality :INT;
E_Addr
:E_KM6551_DIP;
Key
b Error: The function block has an error.
bActive: Indicates whether or not the function block is working.
iErrorID: Contains the error code.
iSignalQuality: LQI value, quality of the signal received; 100 very good transmission, 0 very poor transmission - the LQI value should be as high as possible and should have a minimum value of 10 - 20. You can improve the LQI value by the use of better antennas or shorter cables or better alignment of the antennas.
E_Addr: Reads out the DIP switch setting of the KM6651-0000 module and displays it.