beautypg.com

10 the sm_error.lib library, 1 smc_errorstring, The sm_error.lib library – Lenze PLC Designer PLC-Designer (R2-x) SoftMotion User Manual

Page 244: Smc_errorstring, L-force | plc designer - softmotion

background image

DMS 5.2 EN 03/2011 TD17

L

244

L-force | PLC Designer - SoftMotion

The SM_Error.lib library

SMC_ErrorString

10

The SM_Error.lib library

This library must be available in every project, as it contains all error definitions. It contains

all errors generated by SoftMotion function POUs and can display them as strings.
Basically, the application programmer should note that two types of error may occur in his

or her program. On the one hand, there could be drive errors, which are errors occurring in

the drive (i.e. following errors, missing power supply, etc.). On the other hand, there could

be POU errors, which are errors reported by program organisation units via the Error and

ErrorID outputs and which can often be traced back to incorrect parameterisation.
Drive errors must be read via MC_ReadAxisError or MC_ReadParameter and, where

appropriate, deleted using MC_Reset. Drive errors are drive-specific and are not

standardised.
If necessary, POU errors can be converted into strings by means of the functions in

SM_Error.lib. As these errors could occur on all SoftMotion program organisation units and

would have to be collated by the application, an additional function has been

implemented in the AXIS_REF data structure, allowing a list of the errors that have

occurred most recently to be stored. The FBErrorOccured output of MC_ReadStatus can be

used to check if a POU error has occurred and, if so, which one occurred most recently. The

SMC_ReadFBError function block returns the error number of the first error to have

occurred and the SMC_ClearFBError function clears it.

10.1

SMC_ErrorString

The SMC_ErrorString function returns a string representing the error, in accordance with

the ErrorID (SMC_Error) and Language (SMC_LANGUAGE_TYPE (English, German)) inputs.