aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Stubs Collection/stubs/MotorScrewTest.cs
blob: d4e7ba35704c9a2c9aa6dfe02b6067b33eb56fe6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
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<StubMotorResponse>("StubMotorRequest" ,14, SpeedSet1, 0, 0);
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,14, (x_GET_STATUS)<<16, 0, 0);
		stubManager.WriteHex(response.RecivedData,4);
		stubManager.Write("\n\n");

	 response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,14, Move1, 0, 0);
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,14, (x_GET_STATUS)<<16, 0, 0);
		stubManager.WriteHex(response.RecivedData,4);
		stubManager.Write("\n\n");
	 response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,14, MoveFor, 0, 0);
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,14, (x_GET_STATUS)<<16, 0, 0);
		stubManager.WriteHex(response.RecivedData,4);
		stubManager.Write("\n\n");
	 response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,14, SpeedSet2, 0, 0);
	response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,14, (x_GET_STATUS)<<16, 0, 0);
		stubManager.WriteHex(response.RecivedData,4);
		stubManager.Write("\n\n");
	 response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,14, MoveBack, 0, 0);
	response = stubManager.Run<StubMotorResponse>("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<StubMotorStatusResponse>("StubMotorStatusRequest" ,12, true);
}