Reading DX4 Fault Code Displayed On Front Of Drive

Reading DX4 Fault Code Displayed On Front Of Drive

The code below will move the error number displayed on the 8 segment display
into a declared variable for use in other programs.

'This example is for Axis 0 error number reading
'
'CO_READ_AXIS(axis_number, index, subindex ,type [,vr_number])
'CoE value $603F = Error Code - UINT16


'Declaring Variables
DIM axis0_error_code AS STRING(5)
DIM axis0_error_number AS STRING(2)

VR(500)=0 'Initial clearing of VR value

WHILE TRUE
    'CO_READ_AXIS(axis_number, index, subindex ,type [,vr_number])
    CO_READ_AXIS(0,$603f,0,6,500)
    'Get the hexadecimal value for the decimal number supplied as a STRING
    axis0_error_code = HEX(VR(500))
    axis0_error_number = RIGHT(axis0_error_code,2)'extract the 2 right values of the string
    WA(1000)'Arbitary loop cycle update period
WEND