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
|
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;
include "..\..\Defines\Tango_Defines_Basic.cs"
include "..\Defines\Tango_Defines_LimitSwitch.cs"
//include "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\LAB_Tests\Main_PCB\ATP_Test\Scripts\Defines\Tango_Defines_Basic.cs"
//include "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\LAB_Tests\Main_PCB\ATP_Test\Scripts\Defines\Tango_Defines_LimitSwitch.cs"
public void OnExecute(StubManager stubManager)
{
Int32 Bit = 1;
uint Temp = 0;
int counter = 0;
UInt32 PowerStep_driver=0;
if (Get_Driver_Type(4)>0x14)
PowerStep_driver=1;
for (int i=0;i<1;i++)
{
stubManager.Run<StubMotorMovResponse>("StubMotorMovRequest" ,4, false, 0x800000+2*PowerStep_driver); //mov Dryer Lid motor up
Bit=1;
while (Bit != 0x0) //wait until Dryer Lid open
{
Bit = GetBit(FPGA1, F1_LS_01_Direct,4);
Thread.Sleep(100);
}
stubManager.Write("\n--------1-Lid Open--------");
stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,4, 2); //Hard stop hiZ motor
Thread.Sleep(1000);
stubManager.Run<StubMotorMovResponse>("StubMotorMovRequest" ,4, false, 0x800000+2*(1-PowerStep_driver)); //mov Dryer Lid motor up
Bit = 1;
while (Bit != 0x0) //wait until Dryer Lid open
{
Bit = GetBit(FPGA1, F1_LS_01_Direct,5);
Thread.Sleep(100);
}
stubManager.Write("\n--------2-Lid Close--------\nCycle \t"+i);
stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,4, 2); //Hard stop hiZ motor
}
}
UInt32 Get_Driver_Type(UInt32 i)
{
Int32 x_GET_PARAM = 0x20;
Int32 x_ADC_OUT = 0x12;
UInt32 ADC_out ;
var response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_ADC_OUT)<<8, 0, 0);
ADC_out= (response.RecivedData) & 0x001F;
stubManager.WriteHex(ADC_out,2) ;
return ADC_out ;
}
|