DrvModbusRtu (FB)

FUNCTION_BLOCK DrvModbusRtu EXTENDS AbbLConCA

Function block DrvModbusRtu controls the Modbus RTU communication to ACS/DCS drive and is used for the basic control of drives with ABB Drives Profile or ABB Drives Enhanced profile

ABB Drives Classic Profile

With input parameter EnhancedProfile = FALSE, the function block works for Drives Classic Profile.

Reading status information from Drives: The Function block continuously reads data from the drive starting at Modbus register 400004. So at least the StatusWord(SW), ActualValue 1(Speed Reference), Actual Value 2 are continuously read from the drive and written to the inout variable DriveData. These values are stored in DriveData.wStatusWord, DriveData.iActValue1 and DriveData.iActValue2

With input NvarRead, function block can be configured to read, in the same job between 0..24 data from the drive. These additional data is stored to the array at the ReadValues output. These data have to be configured in the drive and are only accessible if the Embedded Modbus is used.

Writing control word and reference value to drives: The Function Block checks if there are changes of the ControlWord(CW), Reference Value 1(Speed Reference) or Reference Value 2 on the inout variable DriveData. If there is a change, a write job is requested to send these three values to the drive starting at Modbus register 400001.

ABB Drives Enhanced profile

With input EnhancedProfile = TRUE, the function block works for Drives Enhanced Profile.

The ABB Drives Enhanced Profile communication provides register mapped access to the Control, Status, Reference and Actual Values of the ABB Drives Enhanced Profile. The mapping of the registers has been enhanced to allow additional writing of up to 12 control and reading of up to 12 additional status parameters in a single Modbus job.

Reading status information from Drives: The function block continuously reads data from the drive starting at Modbus register 400051. The Status Word(SW), ActualValue 1(Speed Reference), Actual Value 2 are continuously read from the drive and written to the inout variable DriveData. These values are stored in DriveData.wStatusWord, DriveData.iActValue1 and DriveData.iActValue2

Apart from these three parameters there is also an option to read additional 12 more drive parameters in the same Modbus job. Using the input NvarRead, Function block can be configured to read between 1 and 12 parameters from the drive. All read data is then stored to the array at output ReadValues.

Writing controlword and reference value to drives: The Function block checks if there are any changes of ControlWord(CW), Reference Value 1(Speed Reference) or Reference Value 2 on the inout variable DriveData. If there is a change, a write job is requested to send these three values to the drive starting at Modbus register 400001.

Information

  1. Please refer the respective drives / fieldbus module manual for parameter settings and more details on the drive configuration

  2. If a Modbus RTU job tries to access a register in the drive which has no valid mapping information, the job is aborted with an error.

  3. When Embedded Fieldbus settings are used, we can perform only read job from the Drive using Classic Profile. Enhanced profile is not supported in Embedded Fieldbus

  4. When Fieldbus Adapter is configured, then only Enhanced profile can be used to do read(NvarRead) and write(NvarWrite) upto 12 parameters from the drive.

The requests to process other read or write Modbus jobs is transferred via the structure DriveData at the inout variable DriveData which can be connected to several other read/write function blocks e.g. DrvModbusRead, DrvModbusWrite or DrvModbusReadWrite23 of this drive.

If several drives are used, for each drive an instance of communication function block must be programmed. Also every other generic modbus server device on the same Modbus RTU line must be programmed with it´s own ModRtuToken(part of AC500_ModbusRtu library) function block. All these communication Function blocks of one Modbus RTU line must be linked together via one variable of type ModRtuTokenType(part of AC500_ModbusRtu library), connected to the inout variable LineToken. Via this variable the Modbus token is passed to the next drive/device, so that only one device is communicating with the PLC at a time.

Error ERR_COM_DIFFERENT_LINE

In the same LineToken, if one function block has wrong Com port configured. At the program startup (rising edge of Enable input) if this block will occupy the LineToken with its Com value, the following blocks with different values at their Com input will be set to error ERR_COM_DIFFERENT_LINE, even if the following blocks might have the correct Com value. To verify who has occupied LineToken, user can check the byComSlot value in the LineToken variable. To solve this situation, a rising edge (FALSE to TRUE) must be given at Enable input of the function blocks where correct Com input is configured.

Diagnosis

The output ErrorID, which reflects an actual error number is only valid for one cycle if Done is FALSE and Error is set to TRUE. To catch this error number an external function must be programmed. However there are internal diagnosis variables available. Which are not shown at any output, but can be accessed from the Function block instance or Visualization VisuDrvModbusRtu.

The additional diagnosis variables are:

uiWriteErrCnt: Number of errors in write jobs since Enable = TRUE.

wLastWriteErno: Holds the error number of the last executed write job.

uiReadErrCnt: Number of errors in read jobs since Enable = TRUE.

wLastReadErno: Holds the error number of the last executed read job.

uiReadWriteErrCnt: Number of errors in read/Write (FCT-23) write jobs since Enable = TRUE.

wLastReadWriteErno: Holds the error number of the last executed read/Write (FCT-23) job.

xReconnectPause: Timeout or other Modbus server error detected and reconnection pause is active

Note

If the user changes drive profile while drive is online with PLC, Function block output’s may give wrong indication

InOut:

Scope

Name

Type

Initial

Comment

Inherited from

Input

Enable

BOOL

FALSE

A rising edge (Enable = TRUE) starts the operation, the output Busy goes to TRUE. All other inputs are read and considered continuously. A falling edge (Enable = FALSE) aborts the operation. During Aborting the Busy is still TRUE. Afterward all outputs are reset.

AbbLConCA

Output

Busy

BOOL

FALSE

Operation is running (while output Error is FALSE)

AbbLConCA

Error

BOOL

FALSE

Operation is stopped with error (while output Busy is FALSE). This output is TRUE for at least one cycle or until Enable is set to FALSE. The output ErrorID gives more details about the error.

AbbLConCA

Input

Com

BYTE

1

2: Modbus communication port - e.g: 1 = COM1 - changes are valid only after rising edge of Enable input (FALSE -> TRUE). Valid values are 1 to 3 depending on PLC type and configuration.

Serv

BYTE

2

3: Modbus RTU server address. If changed while a modbus job is running, this job will be finished with previous Serv address; valid range is 1..247.

TimeOut

WORD

1000

4: Timeout [ms] for ModRtuMast function block, should be at least 100ms

ReconnectPause

WORD

0

5: Pause in seconds before next retry to connect after a timeout was detected. Timeout is detected with output ModMastErrorIDLast = AC500_ModbusRtu.ERROR_ID.ERR_TIMEOUT (16#120)

Prio

BOOL

FALSE

6: Reserved - not used

EnhancedProfile

BOOL

FALSE

7: To select either ABB Drives Classic profile or ABB Drives Enhanced profile. FALSE = ABB Drives Classic Profile, TRUE = ABB Drives Enhanced Profile. Profile should not be switched when PLC is online with the Drive.

Drive profile has to be properly configured in drives parameters, any mismatch with drive parameter configuration may lead to incorrect block behavior.

NvarRead

BYTE

0

8: Classic Profile: Number of parameters to read from Reg 400004. Max 24. Depending of configured parameters in drive. Only available with ABB Drives profile using embedded fieldbus. Valid range: 0..24

Enhanced Profile: Number of parameters to read from Reg 400004. Max 12. Depending of configured parameters in Group FBA DATA IN in drive. Valid range: 0..12

NvarWrite

BYTE

0

9: Enhanced Profile: Number of parameters to write to Reg 400054. Max 12. Depending of configured parameters in Group FBA DATA OUT in drive. Valid range: 0..12. This variable is applicable only to enhanced profile.

WriteValues

ARRAY [1..12] OF INT

[12(0)]

10: Enhanced Profile: Array of values to write to Reg 400054..400065 of drive configured parameters in Group FBA DATA OUT in drive. This variable is applicable only to enhanced profile.

Inout

LineToken

ModRtuTokenType

11: Reference variable to connect with other DrvModbusRtu/ ModRtuToken function blocks of same Modbus RTU line

DriveData

DrvDataType

12: Drive reference variable to connect to all function blocks of this drive

Output

ErrorID

ERROR_ID

3: Error codes

ModMastErrorAct

BOOL

FALSE

4: Active error in ModMast. Operation is running with error. This output is TRUE for at least one cycle or until Enable is set to FALSE. The output ModMastErrorIDLast gives more details about the last error.

ModMastErrorIDLast

WORD

0

5: Error code of last active error in ModMast. For error code description, refer to error codes in Modbus RTU library, “AC500_ModbusRtu.ERROR_ID”.

WarnAct

BOOL

FALSE

6: Operation is running with warning. This output is TRUE for at least one cycle or until Enable is set to FALSE. The output WarnIDLast gives more details about the warning.

WarnIDLast

WARNING_ID

7: Warning code of last active warning

JobDone

BOOL

FALSE

8: Modbus job done

JobBusy

BOOL

FALSE

9: Modbus job busy

Online

BOOL

FALSE

10: Connection established without error, all read jobs without errors and all Modbus jobs finished within time set at input Timeout

ReadValues

ARRAY [1..24] OF INT

[24(0)]

11: Classic Profile: Array of values read from Reg 400007..400030 from drive parameters mapped in Group EFB DATA I/O. Only available with ABB Drives classic profile using embedded fieldbus.

Enhanced Profile: Array of values read from Reg 400004..400015 from drive parameters mapped in Group FBD DATA IN