Mark -
Here you go. Be aware that this may not be the best method but it seems to be working for me.
The code below works with the following VFD:
http://www.factorymation.com/s.nl/it.A/id.5578/.fTECO 7300CV AC Drive, 3 HP, 230V 1 PH Input, 230V 3 PH Output, 10.5FLA, IP20, Frame 2 (JNTHBCBA0003AC-U)
Contents of Macropump.ms1:
Dim TspinRPM As Integer
If TSpindRPM = 0 Then
SetParam("RPMOverRide",1) 'allows us to over-write the TRUE RPM DRO
RunOnce = 1 'set the flag so this code doesn't run more than once in a session
End If
'Spindle Speed Routine
CurrentSpindleOverRideSpeed = GetOEMDRO(202)
FinalOutputInHz = CurrentSpindleOverRideSpeed * 1.6695 'this is used to correct for actual speed
SetUserDRO(1001,FinalOutputInHz)
'Spindle Power-up/Power-down Routine
If GetOEMLED(164) Then 'check to see if the spindle is moving CW
If Not GetOEMLED(800) Then 'check to see if we are in reset
If GetUserDRO(1001) = 0 Then 'the spindle is at zero rpm,
SetUserDRO(1001,10000) 'Set the spindle to 100hz
Code "S12000" 'set the spindle speed DRO to default off zero
Sleep 1000
Else
SetUserDRO(1000,1) 'start spindle
SetOEMDRO(39,CurrentSpindleOverRideSpeed)
End If
Else
SetUserDRO(1000,0)
End If
Else
SetUserDRO(1000,0)
End If
'Spindle Error Control
CurrentVFDErrorCode = GetUserDRO(1002)
Select Case CurrentVFDErrorCode
Case 0
'nothing is wrong
Case 44
'Modbus communications error
Case 11
'Over Current during accelerating
DoOEMButton(1021) 'hit the reset button
Message("SPINDLE: Over current during accerlation")
SetUserDRO(1000,8) 'reset spindle
Case 11
'Over Current during decceleration
DoOEMButton(1021) 'hit the reset button
Message("SPINDLE: Over current during deccerlation")
SetUserDRO(1000,8) 'reset spindle
Case 30
'Can not start spindle at 0 RPM
DoOEMButton(1021) 'hit the reset button
Message("SPINDLE: Cannot start spindle at zero RPM")
SetUserDRO(1000,8) 'reset spindle
Case Else
'trap
DoOEMButton(1021) 'hit the reset button
Message("SPINDLE: Other error #" & CurrentVFDErrorCode)
SetUserDRO(1000,8) 'reset spindle
End Select
'Spindle Load Update Routine
CurrentSpindleLoad = GetUserDRO(1004)/10
SetUserDRO(1100,CurrentSpindleLoad)
See the attached "MacroPumpInterface.brn" Brain file.
You will also notice that I used UserDRO(1004) to store the current spindle load. I then use that on a modified screen to display the load.
Hope that helps.
david