MP_Addressing

MP_Addressing 1:

This function block allows an MP-Bus slave to be addressed. It is also possible to use this function block to read the serial number of the slave.
MP_Address is used to transfer the address of the slave that is addressed or whose serial number is to be read. The serial number is read out on a rising edge of bReadAddr. It is output through MP_Serial_Numer_Out. A rising edge of bAddrAuto addresses a slave whose address is MP_Address. The function block waits for the time set in TMOUT for the transmission of the slave with its serial number. Transmission of the serial number is initiated differently from one slave to another. Please see the documentation for the MP-Bus device for how the serial number can be sent (in most cases there is a switch on the drive which will trigger this action when pressed). No telegrams are sent to the slaves during the time specified by TMOUT.

A rising edge at bAddrManual initiates manual addressing. This requires the serial number of the drive to be stored in MP_Serial_Number_In. The serial number of the slave can be found on a sticker on the drive.

Sample: 00234-00016-002-031. Enter the following in the variable MP_Serial_Number_IN:

YearAndWeek = 234

DayAndNumber = 16

DeviceFamily = 2

TestStation = 31

FamilySuffix = is not evaluated, and should therefore be ignored.

bBusy is set for as long as the function block is active. An error is indicated through bError, while the error number can be read with iErrorId.

MP_Addressing 2: Inputs

VAR_INPUT
  MP_Address          : USINT := 1;
  bAddrAuto           : BOOL;
  bReadAddr           : BOOL;
  bAddrManual         : BOOL;
  MP_Serial_Number_IN : MP_Serial_Number;
  TMOUT               : TIME := t#30s;
  strDataKL6771       : DataKL6771;
END_VAR

Name

Type

Description

MP_Address

USINT

The MP address that is to be used for the addressing or for reading the serial number. Valid values (1...8).

bAddrAuto

BOOL

A positive edge starts the function block. The function block halts other MP-Bus communication, and waits until the time set through TMOUT has elapsed for an MP-Bus slave has transmitted its serial number, for instance in response to pressing a switch. The MP-Bus address that has been configured in the MP_Address variable is then transmitted to the slave.

bReadAddr

BOOL

A positive edge starts the function block. The function block reads the serial number of the MP-Bus slave whose address is MP_Address.

bAddrManual

BOOL

A positive edge starts the function block. The function block addresses the slave that has serial number MP_Serial_Number_IN. The slave's addresses configured with MP_Address.

MP_Serial_Number_IN

MP_Serial_Number

Serial number of the device

TMOUT

TIME

Automatic addressing is interrupted after the time specified by TMOUT.

strDataKL6771

DataKL6771

The data structure with which the KL6771() function block must be linked.

MP_Addressing 3: Outputs

VAR_OUTPUT
  bBusy                : BOOL;
  bError               : BOOL;
  iErrorId             : MP_Error;
  MP_Serial_Number_OUT : MP_Serial_Number;
END_VAR

Name

Type

Description

bBusy

BOOL

This bit is set for as long as the function block is active.

bError

BOOL

This output goes TRUE as soon as an error occurs. This error is described via the iErrorId variable.

iErrorId

MP_ERROR

This output outputs an error code in the event of an error. bError goes TRUE at the same time.

MP_Serial_Number_OUT

MP_Serial_Number

The serial number of the addressed or requested slave.

Requirements

Development environment

required TC3 PLC library

TwinCAT from v3.1.4020.14

Tc2_MPBus from 3.3.5.0