using System; using System.Text; using System.Linq; using System.Drawing; using System.Diagnostics; using System.Windows.Forms; using System.Threading; using System.Threading.Tasks; using System.Collections.Generic; using Tango.PMR.Stubs; using Tango.Stubs; const Int32 x_GET_STATUS = 0xD0; const Int32 x_ABS_POS = 0x01; const Int32 x_EL_POS = 0x02; const Int32 x_MARK = 0x03; const Int32 x_SPEED = 0x04; const Int32 x_ACC = 0x05; const Int32 x_DEC = 0x06; const Int32 x_MAX_SPEED = 0x07; const Int32 x_MIN_SPEED = 0x08; const Int32 x_FS_SPD = 0x15; const Int32 x_KVAL_HOLD = 0x09; const Int32 x_KVAL_RUN = 0x0A; const Int32 x_KVAL_ACC = 0x0B; const Int32 x_KVAL_DEC = 0x0C; const Int32 x_INT_SPD = 0x0D; const Int32 x_ST_SLP = 0x0E; const Int32 x_FN_SLP_ACC = 0x0F; const Int32 x_FN_SLP_DEC = 0x10; const Int32 x_K_THERM = 0x11; const Int32 x_ADC_OUT = 0x12; const Int32 x_OCD_TH = 0x13; const Int32 x_STALL_TH = 0x14; const Int32 x_STEP_MODE = 0x16; const Int32 x_ALARM_EN = 0x17; const Int32 x_CONFIG = 0x18; const Int32 x_STATUS = 0x19; //------------------------------- const Int32 x_GET_PARAM = 0x20; const Int32 x_SET_PARAM = 0x00; public void OnExecute(StubManager stubManager) { Uint32 SpeedSet1 = 0x7000062; Uint32 SpeedSet2 = 0x7000053; Uint32 Move1 = 0x4000026c; Uint32 MoveFor = 0x400007D0; Uint32 MoveBack = 0x410007D0; var response = stubManager.Run("StubMotorRequest" ,14, SpeedSet1, 0, 0); response = stubManager.Run("StubMotorRequest" ,14, (x_GET_STATUS)<<16, 0, 0); stubManager.WriteHex(response.RecivedData,4); stubManager.Write("\n\n"); response = stubManager.Run("StubMotorRequest" ,14, Move1, 0, 0); response = stubManager.Run("StubMotorRequest" ,14, (x_GET_STATUS)<<16, 0, 0); stubManager.WriteHex(response.RecivedData,4); stubManager.Write("\n\n"); response = stubManager.Run("StubMotorRequest" ,14, MoveFor, 0, 0); response = stubManager.Run("StubMotorRequest" ,14, (x_GET_STATUS)<<16, 0, 0); stubManager.WriteHex(response.RecivedData,4); stubManager.Write("\n\n"); response = stubManager.Run("StubMotorRequest" ,14, SpeedSet2, 0, 0); response = stubManager.Run("StubMotorRequest" ,14, (x_GET_STATUS)<<16, 0, 0); stubManager.WriteHex(response.RecivedData,4); stubManager.Write("\n\n"); response = stubManager.Run("StubMotorRequest" ,14, MoveBack, 0, 0); response = stubManager.Run("StubMotorRequest" ,14, (x_GET_STATUS)<<16, 0, 0); stubManager.WriteHex(response.RecivedData,4); stubManager.Write("\n\n"); // Request ---- // UInt32 : MotorID // Boolean : ClearStatus // Response ---- // UInt32 : MotorID // Boolean : SCKMOD // Boolean : STEPLOSSB // Boolean : STEPLOSSA // Boolean : OCD // Boolean : THSD // Boolean : THWRN // Boolean : UVLO // Boolean : WRONGCMD // Boolean : NOTPERFCMD // UInt32 : MOTSTATUS // Boolean : DIR // Boolean : SWEVN // Boolean : SWF // Boolean : BUSY // Boolean : HiZ //response = stubManager.Run("StubMotorStatusRequest" ,12, true); }