aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Stubs Collection/stubs/Scripts
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-01-30 11:53:08 +0200
committerShlomo Hecht <shlomo@twine-s.com>2019-01-30 11:53:08 +0200
commit35ca91ca151dfbbe7e4ec560dca5630a8d7113e1 (patch)
tree0e6644bca8ce253c452e43e701af1b6c0bf51275 /Software/Stubs Collection/stubs/Scripts
parent99554aaefd61f29be38669d46c7e4a573bec311f (diff)
downloadTango-35ca91ca151dfbbe7e4ec560dca5630a8d7113e1.tar.gz
Tango-35ca91ca151dfbbe7e4ec560dca5630a8d7113e1.zip
Read ADC - one at a time. update stubs from Mati
Diffstat (limited to 'Software/Stubs Collection/stubs/Scripts')
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/Dispenser/Dispenser_3WValve.cs80
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/Dispenser/Dispenser_LimitSwitch.cs86
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/Dispenser/Dispenser_Motors.cs87
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/Dispenser/Dispenser_PressureSensor.cs36
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/Dispenser/Dispenser_SSI.cs93
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/Dispenser/prescalar2.cs26
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/Dryer_LimitSwitch.cs46
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/Dryer_Motors.cs62
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/Dryer_QEI.cs37
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/Dryer_SSR.cs39
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/Dryer_ssi.cs48
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/GPO_BLOWER_PWM_Precent_.cs22
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/GPO_Blower_PWM.cs37
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/ElectricalEnclosure/ElectricalEnclosure_Fans.cs96
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/Header/header_LimitSwitch.cs48
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/Header/magner_ssr.cs67
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/LTFU/LTFU_LimitSwitch.cs48
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/LTFU/LTFU_Motors.cs79
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/LTFU/LTFU_Motors_Switch.cs113
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/LTFU/LTFU_Motors_Switch1.cs208
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/LTFU/LTFU_SSI.cs48
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/LTFU/test.cs25
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/MidTank/Midtank_Valves.cs80
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/MidTank/Midtank_pressure_sensors.cs172
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/Other/All_PT100.cs99
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/Other/I2C_DAC_MultiBytes.cs64
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/Other/PT100__Horizontal_Printing.cs58
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/Other/Tiva_Analogs.cs34
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/Other/i2c_mcp9600.cs97
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/RTFU/RTFU_GPO.cs36
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/RTFU/RTFU_LimitSwitch.cs44
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/RTFU/RTFU_LimitSwitch1.cs71
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/RTFU/RTFU_Motors.cs69
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/RTFU/RTFU_Motors_Switch.cs71
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/RTFU/RTFU_Motors_Switch1.cs174
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/RTFU/RTFU_SSI.cs49
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Winder_LimitSwitch.cs44
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Winder_Motors.cs130
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Winder_Screw_Motors.cs76
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Winder_Screw_Motors1.cs91
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_3WValve.cs16
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_Basic.cs96
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_GPO.cs21
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_LimitSwitch.cs39
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_Motors.cs413
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_PT100.cs219
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_QEI.cs37
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_SSI.cs131
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_SSR.cs22
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_Tacho.cs45
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Read_Version.cs110
-rw-r--r--Software/Stubs Collection/stubs/Scripts/read embedded version.cs23
52 files changed, 4062 insertions, 0 deletions
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Dispenser/Dispenser_3WValve.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dispenser/Dispenser_3WValve.cs
new file mode 100644
index 000000000..8ee635cb3
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dispenser/Dispenser_3WValve.cs
@@ -0,0 +1,80 @@
+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 "Tango_Defines_3WValve.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_3WValve.cs"
+
+
+int ThreeWayValve_Dispenser (Int32 DispNo)
+{
+ Int32 Valve = 0;
+ Int32 Bit;
+
+ //Enable Valve chip
+ SetBit(FPGA2, F2_DISPENSER_VALVE_OUT, (DispNo-1) + 8, 0x1);
+ stubManager.Write("\nEnabling Valve no. ");
+ stubManager.Write(DispNo);
+
+ //Flip direction
+ Bit = GetBit(FPGA2, F2_DISPENSER_VALVE_OUT, (DispNo-1));
+ Bit = Bit ^ 0x1;
+ SetBit(FPGA2, F2_DISPENSER_VALVE_OUT, (DispNo-1), (Bit & 0x1));
+ stubManager.Write("\nFlipping Valve no. ");
+ stubManager.Write(DispNo);
+
+ //Check if valve is BUSY
+ Bit = GetBit(FPGA2, F2_DISPENSER_VALVE_IN_Direct, 15-(DispNo-1));
+
+ while (Bit == 0x1)
+ {
+
+ Bit = GetBit(FPGA2, F2_DISPENSER_VALVE_IN_Direct, 15-(DispNo-1));
+ stubManager.Write("\nBUSY Valve no. ");
+ stubManager.Write(DispNo);
+
+ }
+
+ //Disable Valve chip
+ SetBit(FPGA2, F2_DISPENSER_VALVE_OUT, (DispNo-1)+8, (Bit & 0x1));
+ stubManager.Write("\nDisabling Valve no. ");
+ stubManager.Write(DispNo);
+
+ return 1;
+
+}
+
+
+
+
+public void OnExecute(StubManager stubManager)
+{
+ const Int32 Delay = 2000;
+ int DispenserNo = 0;
+
+ //Set Valve pre-scaler value to 50ms
+ Fpga_Write_Reg(FPGA2, F2_Prescaler1_reg12, 0x120, 0);
+
+
+ //Invoke the response window with custom message and default response.
+ var response = stubManager.ShowResponseWindow("Enter dispenser number to test (1-8):", "");
+ //stubManager.WriteLine(response);
+ stubManager.Write("\n");
+ DispenserNo = int.Parse(response);
+ ThreeWayValve_Dispenser (DispenserNo);
+ Thread.Sleep(Delay);
+ ThreeWayValve_Dispenser (DispenserNo);
+ Thread.Sleep(Delay);
+
+
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Dispenser/Dispenser_LimitSwitch.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dispenser/Dispenser_LimitSwitch.cs
new file mode 100644
index 000000000..90ad540f9
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dispenser/Dispenser_LimitSwitch.cs
@@ -0,0 +1,86 @@
+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 "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"
+
+int LimitSW_Dispenser(Int32 Fpga, Int32 Adr, int DispenserNo)
+{
+ uint Temp = 0;
+ int counter = 0;
+ stubManager.Write("\n\nTesting limit switches dispensers no. "); stubManager.Write(DispenserNo);
+ stubManager.Write("\nReading register "); stubManager.Write(Adr); stubManager.Write(", Value: ");
+ var RetVal = Fpga_Read_Reg(Fpga, Adr, 0);
+ stubManager.WriteHex(RetVal.Value,4);
+ Temp = RetVal.Value;
+ stubManager.Write("\nActivate limit switches one-by-one");
+
+ while ( counter != 100)
+ {
+ RetVal = Fpga_Read_Reg(Fpga, Adr, 0);
+ if (RetVal.Value != Temp)
+ {
+ stubManager.Write("\nRegister new value: ");
+ stubManager.WriteHex(RetVal.Value,4);
+ counter = counter + 1;
+ }
+ Thread.Sleep(100);
+ }
+
+
+ return 1;
+}
+
+
+public void OnExecute(StubManager stubManager)
+{
+
+
+ int DispenserNo = 0;
+ stubManager.Write("\n\n*** Dispenser Limit Switch Test ***\n");
+
+ //Invoke the response window with custom message and default response.
+ var response = stubManager.ShowResponseWindow("Enter dispenser number to test (1-8):", "");
+ stubManager.Write("\n");
+ DispenserNo = int.Parse(response);
+
+ switch (DispenserNo)
+ {
+ case 1:
+ LimitSW_Dispenser(FPGA2, F2_LS_01_Direct, 1);
+ break;
+ case 2:
+ LimitSW_Dispenser(FPGA2, F2_LS_01_Direct, 2);
+ break;
+ case 3:
+ LimitSW_Dispenser(FPGA2, F2_LS_02_Direct, 3);
+ break;
+ case 4:
+ LimitSW_Dispenser(FPGA2, F2_LS_02_Direct, 4);
+ break;
+ case 5:
+ LimitSW_Dispenser(FPGA2, F2_LS_03_Direct, 5);
+ break;
+ case 6:
+ LimitSW_Dispenser(FPGA2, F2_LS_03_Direct, 6);
+ break;
+ case 7:
+ LimitSW_Dispenser(FPGA2, F2_LS_04_Direct, 7);
+ break;
+ case 8:
+ LimitSW_Dispenser(FPGA2, F2_LS_04_Direct, 8);
+ break;
+ }
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Dispenser/Dispenser_Motors.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dispenser/Dispenser_Motors.cs
new file mode 100644
index 000000000..fe05505a7
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dispenser/Dispenser_Motors.cs
@@ -0,0 +1,87 @@
+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 "Tango_Defines_Motors.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_Motors.cs"
+
+
+int Motor_Dispenser(Int32 Fpga, Int32 HighAdr, Int32 LowAdr, Int32 DispenserNo)
+{
+
+ stubManager.Write("\n*** Pulling dispenser no. "); stubManager.Write(DispenserNo); stubManager.Write(" motor driver out of reset");
+ SetBit(Fpga, F2_Moto_Driver_NSTBYRST1, (8-DispenserNo), 1);
+
+ //Place in high-Z state
+ stubManager.Write("\n*** Place in high-Z state");
+ Motor_HighZ(Fpga, HighAdr, LowAdr);
+
+ //Motor_ReadCfg(Fpga, HighAdr, LowAdr);
+
+ stubManager.Write("\n*** Moving dispenser motor no. "); stubManager.Write(DispenserNo); stubManager.Write(" back and for for 2 times...");
+ //Motor_Move_Loop(Fpga, HighAdr, LowAdr, 0x39000, 0x0, 2);
+ Motor_Run(Fpga, HighAdr, LowAdr, 0xffff, 0x1);
+ Thread.Sleep(2000);
+ Motor_HighZ(Fpga, HighAdr, LowAdr);
+ Motor_Run(Fpga, HighAdr, LowAdr, 0xffff, 0x0);
+ Thread.Sleep(2000);
+ Motor_HighZ(Fpga, HighAdr, LowAdr);
+ stubManager.Write("\n*** Stopped dispenser motor no. "); stubManager.Write(DispenserNo); //stubManager.Write(" ");
+
+ return 1;
+}
+
+
+
+public void OnExecute(StubManager stubManager)
+{
+ int DispenserNo = 0;
+ stubManager.Write("\n\n*** Dispenser Motor Test ***\n");
+
+ //Invoke the response window with custom message and default response.
+ var response = stubManager.ShowResponseWindow("Enter dispenser number to test (1-8):", "");
+ //stubManager.WriteLine(response);
+ stubManager.Write("\n");
+ DispenserNo = int.Parse(response);
+
+ switch (DispenserNo)
+ {
+ case 1:
+ Motor_Dispenser(FPGA2, F2_MOTO_DISPENSER_A1_1_TX_01, F2_MOTO_DISPENSER_A1_1_TX_00, 1);
+ break;
+ case 2:
+ Motor_Dispenser(FPGA2, F2_MOTO_DISPENSER_A1_2_TX_01, F2_MOTO_DISPENSER_A1_2_TX_00, 2);
+ break;
+ case 3:
+ Motor_Dispenser(FPGA2, F2_MOTO_DISPENSER_A1_3_TX_01, F2_MOTO_DISPENSER_A1_3_TX_00, 3);
+ break;
+ case 4:
+ Motor_Dispenser(FPGA2, F2_MOTO_DISPENSER_A1_4_TX_01, F2_MOTO_DISPENSER_A1_4_TX_00, 4);
+ break;
+ case 5:
+ Motor_Dispenser(FPGA2, F2_MOTO_DISPENSER_A1_5_TX_01, F2_MOTO_DISPENSER_A1_5_TX_00, 5);
+ break;
+ case 6:
+ Motor_Dispenser(FPGA2, F2_MOTO_DISPENSER_A1_6_TX_01, F2_MOTO_DISPENSER_A1_6_TX_00, 6);
+ break;
+ case 7:
+ Motor_Dispenser(FPGA2, F2_MOTO_DISPENSER_A1_7_TX_01, F2_MOTO_DISPENSER_A1_7_TX_00, 7);
+ break;
+ case 8:
+ Motor_Dispenser(FPGA2, F2_MOTO_DISPENSER_A1_8_TX_01, F2_MOTO_DISPENSER_A1_8_TX_00, 8);
+ break;
+ }
+
+ stubManager.Write("\n\n*** Dispenser Motor Test Ended ***");
+
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Dispenser/Dispenser_PressureSensor.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dispenser/Dispenser_PressureSensor.cs
new file mode 100644
index 000000000..11a419576
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dispenser/Dispenser_PressureSensor.cs
@@ -0,0 +1,36 @@
+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;
+
+/*
+Name Input channel Input parameter in the stub
+CHAN_DISPENSE_PRESSURE_1 ADC_CTL_CH2 2
+CHAN_DISPENSE_PRESSURE_2 ADC_CTL_CH3 3
+CHAN_DISPENSE_PRESSURE_3 ADC_CTL_CH4 4
+CHAN_DISPENSE_PRESSURE_4 ADC_CTL_CH5 5
+CHAN_DISPENSE_PRESSURE_5 ADC_CTL_CH6 6
+CHAN_DISPENSE_PRESSURE_6 ADC_CTL_CH7 7
+CHAN_DISPENSE_PRESSURE_7 ADC_CTL_CH8 8
+CHAN_DISPENSE_PRESSURE_8 ADC_CTL_CH9 9
+*/
+
+public void OnExecute(StubManager stubManager)
+{
+
+ for (int i=2; i<10; i++)
+ {
+ Thread.Sleep(1000);
+ var response = stubManager.Run<StubIntADCReadResponse>("StubIntADCReadRequest" ,i);
+ stubManager.Write("\nADC VALUE, DISPENSER "); stubManager.Write(i-1); stubManager.Write("\t"); stubManager.WriteHex(response.SamplingInBits, 4); stubManager.Write("\t"); stubManager.Write(response.VoltageSamplingMv); stubManager.Write(" mV");
+ }
+
+
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Dispenser/Dispenser_SSI.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dispenser/Dispenser_SSI.cs
new file mode 100644
index 000000000..692f9d32c
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dispenser/Dispenser_SSI.cs
@@ -0,0 +1,93 @@
+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 "Tango_Defines_SSI.cs"
+//include "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\Software\Stub_scripts\Tango_Defines_Basic.cs"
+//include "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\Software\Stub_scripts\Interfaces\Tango_Defines_SSI.cs"
+
+
+public void OnExecute(StubManager stubManager)
+{
+ int k = 0;
+ Fpga_Read_Reg(FPGA1, F2_Prescaler1_reg1, 0);
+ Fpga_Read_Reg(FPGA1, F2_Prescaler1_reg2, 0);
+
+ //Set output clock frequency to about 200 kHz
+ Fpga_Write_Reg(FPGA1, F2_Prescaler1_reg1, 0x0024, 0);
+ Fpga_Write_Reg(FPGA1, F2_Prescaler1_reg2, 0x0024, 0);
+
+ Fpga_Read_Reg(FPGA1, F2_Prescaler1_reg1, 0);
+ Fpga_Read_Reg(FPGA1, F2_Prescaler1_reg2, 0);
+
+ for (int i = 0; i < 100000; i++)
+ {
+
+
+
+
+
+ SSI_Read_Write(FPGA2, F2_DISPENSER_ROTENC_1_MSB, F2_DISPENSER_ROTENC_1_LSB, F2_DISPENSER_ROTENC_1_TX);
+ SSI_Read_Write(FPGA2, F2_DISPENSER_ROTENC_2_MSB, F2_DISPENSER_ROTENC_2_LSB, F2_DISPENSER_ROTENC_2_TX);
+ SSI_Read_Write(FPGA2, F2_DISPENSER_ROTENC_3_MSB, F2_DISPENSER_ROTENC_3_LSB, F2_DISPENSER_ROTENC_3_TX);
+ SSI_Read_Write(FPGA2, F2_DISPENSER_ROTENC_4_MSB, F2_DISPENSER_ROTENC_4_LSB, F2_DISPENSER_ROTENC_4_TX);
+ stubManager.Write("\n");
+ Thread.Sleep(400);
+ SSI_Read_Write(FPGA2, F2_DISPENSER_ROTENC_5_MSB, F2_DISPENSER_ROTENC_5_LSB, F2_DISPENSER_ROTENC_5_TX);
+ SSI_Read_Write(FPGA2, F2_DISPENSER_ROTENC_6_MSB, F2_DISPENSER_ROTENC_6_LSB, F2_DISPENSER_ROTENC_6_TX);
+ SSI_Read_Write(FPGA2, F2_DISPENSER_ROTENC_7_MSB, F2_DISPENSER_ROTENC_7_LSB, F2_DISPENSER_ROTENC_7_TX);
+ SSI_Read_Write(FPGA2, F2_DISPENSER_ROTENC_8_MSB, F2_DISPENSER_ROTENC_8_LSB, F2_DISPENSER_ROTENC_8_TX);
+ stubManager.Write("\n");
+ Thread.Sleep(400);
+
+
+
+ Thread.Sleep(400);
+ stubManager.Write("\n");
+ k++;
+ if ( (k & 0x8) == 0x08 ) {
+ k = 0;
+ stubManager.Write(" DISPENSER1 DISPENSER2 DISPENSER3 DISPENSER4 \n");
+ stubManager.Write(" DISPENSER5 DISPENSER6 DISPENSER7 DISPENSER8 \n");
+ }
+
+ /*
+ stubManager.Write("\n\nF1_LDANCER1_ROTENC_TX");
+ ssi_loop(F1_LDANCER1_ROTENC_TX);
+ Thread.Sleep(1000);
+
+ stubManager.Write("\n\nF1_LDANCER2_ROTENC_TX");
+ ssi_loop(F1_LDANCER2_ROTENC_TX);
+ Thread.Sleep(1000);
+
+ stubManager.Write("\n\nF1_LSPARE_ROTENC_TX");
+ ssi_loop(F1_LSPARE_ROTENC_TX);
+ Thread.Sleep(1000);
+
+ */
+ }
+
+
+}
+
+/* Sample output when turning F1_RSPARE_ROTENC - output is 12 bits
+(F1_RSPARE_ROTENC_MSB, F1_RSPARE_ROTENC_LSB) = (#0000, #0A6F)
+(F1_RSPARE_ROTENC_MSB, F1_RSPARE_ROTENC_LSB) = (#0000, #0A71)
+(F1_RSPARE_ROTENC_MSB, F1_RSPARE_ROTENC_LSB) = (#0000, #0A68)
+(F1_RSPARE_ROTENC_MSB, F1_RSPARE_ROTENC_LSB) = (#0000, #09BA)
+(F1_RSPARE_ROTENC_MSB, F1_RSPARE_ROTENC_LSB) = (#0000, #0859)
+(F1_RSPARE_ROTENC_MSB, F1_RSPARE_ROTENC_LSB) = (#0000, #06C6)
+(F1_RSPARE_ROTENC_MSB, F1_RSPARE_ROTENC_LSB) = (#0000, #05EA)
+(F1_RSPARE_ROTENC_MSB, F1_RSPARE_ROTENC_LSB) = (#0000, #05CE)
+(F1_RSPARE_ROTENC_MSB, F1_RSPARE_ROTENC_LSB) = (#0000, #05B3)
+(F1_RSPARE_ROTENC_MSB, F1_RSPARE_ROTENC_LSB) = (#0000, #0599)
+(F1_RSPARE_ROTENC_MSB, F1_RSPARE_ROTENC_LSB) = (#0000, #0580)*/ \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Dispenser/prescalar2.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dispenser/prescalar2.cs
new file mode 100644
index 000000000..305cc6c5f
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dispenser/prescalar2.cs
@@ -0,0 +1,26 @@
+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 "Tango_Defines_SSI.cs"
+
+const Int32 FPGA2 = 0x60000400;
+const Int32 F1_Prescaler1_reg1 = 0x122;
+
+public void OnExecute(StubManager stubManager)
+{
+ Fpga_Read_Reg(FPGA2, F1_Prescaler1_reg1, 0);
+
+ //Set output clock frequency to about 200 kHz
+ Fpga_Write_Reg(FPGA2, F1_Prescaler1_reg1, 0x0250, 0);
+
+ Fpga_Read_Reg(FPGA2, F1_Prescaler1_reg1, 0);
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/Dryer_LimitSwitch.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/Dryer_LimitSwitch.cs
new file mode 100644
index 000000000..1700600be
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/Dryer_LimitSwitch.cs
@@ -0,0 +1,46 @@
+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)
+{
+
+ uint Temp = 0;
+ int counter = 0;
+ stubManager.Write("\nReading register F1_LS_02_Direct: ");
+ var RetVal = Fpga_Read_Reg(FPGA1, F1_LS_02_Direct, 0);
+ stubManager.WriteHex(RetVal.Value,4);
+ Temp = RetVal.Value;
+ stubManager.Write("\nActivate limit switches one-by-one");
+
+ while ( counter != 100)
+ {
+ RetVal = Fpga_Read_Reg(FPGA1, F1_LS_02_Direct, 0);
+ if (RetVal.Value != Temp)
+ {
+ stubManager.Write("\nRegister F1_LS_02_Direct new value: ");
+ stubManager.WriteHex(RetVal.Value,4);
+ counter = counter + 1;
+ }
+ Temp = RetVal.Value;
+
+ Thread.Sleep(100);
+ }
+
+
+
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/Dryer_Motors.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/Dryer_Motors.cs
new file mode 100644
index 000000000..35f463ce9
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/Dryer_Motors.cs
@@ -0,0 +1,62 @@
+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 "Tango_Defines_Motors.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_Motors.cs"
+
+
+public void OnExecute(StubManager stubManager)
+{
+
+ stubManager.Write("\n\n*** Dryer Motor Test ***\n");
+
+ stubManager.Write("\n*** Pulling motor drivers out of reset\n");
+ SetBit(FPGA1, F1_Moto_Driver_NSTBYRST1, 5, 1);
+ //SetBit(FPGA1, F1_Moto_Driver_NSTBYRST1, 6, 1);
+ SetBit(FPGA1, F1_Moto_Driver_NSTBYRST1, 7, 1);
+
+
+
+ //Place in high-Z state
+ stubManager.Write("\n*** Place in high-Z state\n");
+ Motor_HighZ(FPGA1, F1_MOTO_DRYER_DRIVING_A1_TX_01, F1_MOTO_DRYER_DRIVING_A1_TX_00);
+ Motor_HighZ(FPGA1, F1_MOTO_DRYER_LOADARM_A1_TX_01, F1_MOTO_DRYER_LOADARM_A1_TX_00);
+ //Motor_HighZ(FPGA1, F1_MOTO_DRYER_LID_A1_TX_01, F1_MOTO_DRYER_LID_A1_TX_00);
+
+ //Motor_ReadCfg(FPGA1, F1_MOTO_DRYER_DRIVING_A1_TX_01, F1_MOTO_DRYER_DRIVING_A1_TX_00);
+ //Motor_ReadCfg(FPGA1, F1_MOTO_DRYER_LOADARM_A1_TX_01, F1_MOTO_DRYER_LOADARM_A1_TX_00);
+ //Motor_ReadCfg(FPGA1, F1_MOTO_DRYER_LID_A1_TX_01, F1_MOTO_DRYER_LID_A1_TX_00);
+
+ stubManager.Write("\n*** Running motor F1_MOTO_DRYER_DRIVING for 8 seconds... ");
+ Motor_Run(FPGA1, F1_MOTO_DRYER_DRIVING_A1_TX_01, F1_MOTO_DRYER_DRIVING_A1_TX_00, 0xffff, 0x1);
+ Thread.Sleep(8000);
+ Motor_HighZ(FPGA1, F1_MOTO_DRYER_DRIVING_A1_TX_01, F1_MOTO_DRYER_DRIVING_A1_TX_00);
+ stubManager.Write("\n*** Stopped motor F1_MOTO_DRYER_DRIVING");
+
+ stubManager.Write("\n\n*** Moving motor F1_MOTO_DRYER_LOADARM back and for for 4 times...");
+ Motor_Move_Loop(FPGA1, F1_MOTO_DRYER_LOADARM_A1_TX_01, F1_MOTO_DRYER_LOADARM_A1_TX_00, 0x0800, 0x1, 4);
+ Motor_HighZ(FPGA1, F1_MOTO_DRYER_LOADARM_A1_TX_01, F1_MOTO_DRYER_LOADARM_A1_TX_00);
+ stubManager.Write("\n*** Stopped motor F1_MOTO_DRYER_LOADARM");
+
+ /*
+ stubManager.Write("\n\n*** Moving motor F1_MOTO_DRYER_LID back and for for 4 times...");
+ Motor_Move_Loop(FPGA1, F1_MOTO_DRYER_LID_A1_TX_01, F1_MOTO_DRYER_LID_A1_TX_00, 0x0800, 0x1, 4);
+ Motor_HighZ(FPGA1, F1_MOTO_DRYER_LID_A1_TX_01, F1_MOTO_DRYER_LID_A1_TX_00);
+ stubManager.Write("\n*** Stopped motor F1_MOTO_DRYER_LID");
+ */
+
+
+ stubManager.Write("\n\n*** Dryer Motor Test Ended ***");
+
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/Dryer_QEI.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/Dryer_QEI.cs
new file mode 100644
index 000000000..076a0fbdb
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/Dryer_QEI.cs
@@ -0,0 +1,37 @@
+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 "Tango_Defines_QEI.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_QEI.cs""
+
+
+public void OnExecute(StubManager stubManager)
+{
+
+ for (int i = 0; i < 100; i++)
+ {
+ stubManager.Write("\n");
+ var rv1 = Fpga_Read_Reg(FPGA1, F1_DRYER_LOADARM_ROTENC_lsb, 0);
+ var rv2 = Fpga_Read_Reg(FPGA1, F1_DRYER_LOADARM_ROTENC_msb, 0);
+
+ stubManager.WriteHex(rv2.Value, 4);
+ stubManager.Write("\t");
+ stubManager.WriteHex(rv1.Value, 4);
+
+ stubManager.Write("\n");
+
+ Thread.Sleep(400);
+ }
+
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/Dryer_SSR.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/Dryer_SSR.cs
new file mode 100644
index 000000000..da391cfb2
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/Dryer_SSR.cs
@@ -0,0 +1,39 @@
+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 "Tango_Defines_SSR.cs"
+//include "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\Software\Stub_scripts\Tango_Defines_Basic.cs"
+//include "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\Software\Stub_scripts\Interfaces\Tango_Defines_SSR.cs"
+
+
+public void OnExecute(StubManager stubManager)
+{
+ //Write GPO_DRYER_SSR1_CTRL SSR/SSR no. 1
+ SetBit (FPGA2, F2_CTRL, 10, 1);
+ stubManager.Write("\nTesting SSR no. 1");
+ Thread.Sleep(4000);
+ SetBit (FPGA2, F2_CTRL, 10, 0);
+
+ //Write GPO_DRYER_SSR2_CTRL SSR/SSR no. 2
+ SetBit (FPGA2, F2_CTRL, 9, 1);
+ stubManager.Write("\nTesting SSR no. 2");
+ Thread.Sleep(4000);
+ SetBit (FPGA2, F2_CTRL, 9, 0);
+
+ //Write GPO_DRYER_SSR3_CTRL SSR/SSR no. 3
+ SetBit (FPGA2, F2_CTRL, 8, 1);
+ stubManager.Write("\nTesting SSR no. 3");
+ Thread.Sleep(4000);
+ SetBit (FPGA2, F2_CTRL, 8, 0);
+
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/Dryer_ssi.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/Dryer_ssi.cs
new file mode 100644
index 000000000..c48802dbe
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/Dryer_ssi.cs
@@ -0,0 +1,48 @@
+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 "Tango_Defines_SSI.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_SSI.cs"
+
+
+public void OnExecute(StubManager stubManager)
+{
+ int k = 0;
+ Fpga_Read_Reg(FPGA1, F1_Prescaler1_reg1, 0);
+ Fpga_Read_Reg(FPGA1, F1_Prescaler1_reg2, 0);
+
+ //Set output clock frequency to about 200 kHz
+ Fpga_Write_Reg(FPGA1, F1_Prescaler1_reg1, 0x0024, 0);
+ Fpga_Write_Reg(FPGA1, F1_Prescaler1_reg2, 0x0024, 0);
+
+ Fpga_Read_Reg(FPGA1, F1_Prescaler1_reg1, 0);
+ Fpga_Read_Reg(FPGA1, F1_Prescaler1_reg2, 0);
+
+ for (int i = 0; i < 1000; i++)
+ {
+
+ SSI_Read_Write(FPGA1, F1_LSPARE_ROTENC_MSB, F1_LSPARE_ROTENC_LSB, F1_LSPARE_ROTENC_TX);
+// SSI_Read_Write(FPGA1, F1_LDANCER2_ROTENC_MSB, F1_LDANCER2_ROTENC_LSB, F1_LDANCER2_ROTENC_TX);
+ stubManager.Write("\n");
+ k++;
+ if ( (k & 0x8) == 0x08 ) {
+ k = 0;
+ stubManager.Write(" LDANCER1 LDANCER2 \n");
+ }
+
+ Thread.Sleep(40);
+ }
+
+
+}
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/GPO_BLOWER_PWM_Precent_.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/GPO_BLOWER_PWM_Precent_.cs
new file mode 100644
index 000000000..f17802815
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/GPO_BLOWER_PWM_Precent_.cs
@@ -0,0 +1,22 @@
+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;
+
+public void OnExecute(StubManager stubManager)
+{
+ const int LOW = 0;//0 - 100%
+ var response = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000400 | 0x112, 0xFF);//Freq 8 bit
+ var response1 = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000400 | 0x3EC, LOW+1);//Low 8 bit
+ var response2 = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000400 | 0x3EE, 101 - LOW);//High 8 bit
+
+ // low + high = 100 % in order use the same freq
+ // there is option to change only the high (low + freq constasnt) this will chnga the freq
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/GPO_Blower_PWM.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/GPO_Blower_PWM.cs
new file mode 100644
index 000000000..d7c4894c6
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/GPO_Blower_PWM.cs
@@ -0,0 +1,37 @@
+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 "Tango_Defines_SSR.cs"
+
+
+
+
+public void OnExecute(StubManager stubManager)
+{
+ SetBit(FPGA1,0x3d2,5,0); //turn on Blower
+ SetBit(FPGA1,0x3d2,4,0); //Dir
+ SetBit(FPGA1,0x3d2,3,1); //Torqer High
+
+
+
+ const int LOW = 50;//0 - 100%
+ var response = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000400 | 0x112, 0xFF);//Freq 8 bit
+ var response1 = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000400 | 0x3EC, LOW+1);//Low 8 bit
+ var response2 = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000400 | 0x3EE, 101 - LOW);//High 8 bit
+
+ Thread.Sleep(4000);
+ SetBit(FPGA1,0x3d2,5,1); //turn off Blower
+
+ // low + high = 100 % in order use the same freq
+ // there is option to change only the high (low + freq constasnt) this will chnga the freq
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/ElectricalEnclosure/ElectricalEnclosure_Fans.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/ElectricalEnclosure/ElectricalEnclosure_Fans.cs
new file mode 100644
index 000000000..f28b38582
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/ElectricalEnclosure/ElectricalEnclosure_Fans.cs
@@ -0,0 +1,96 @@
+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 "Tango_Defines_Tacho.cs"
+//include "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\Software\Stub_scripts\Tango_Defines_Basic.cs"
+//include "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\Software\Stub_scripts\Interfaces\Tango_Defines_Tacho.cs"
+
+
+public void OnExecute(StubManager stubManager)
+{
+
+
+ Fpga_Read_Reg(FPGA1, F1_Prescaler1_reg1, 1); stubManager.Write("\n");
+ Fpga_Read_Reg(FPGA1, F1_Prescaler1_reg2, 1); stubManager.Write("\n");
+ Fpga_Read_Reg(FPGA1, F1_Prescaler1_reg3, 1); stubManager.Write("\n");
+ Fpga_Read_Reg(FPGA1, F1_Prescaler1_reg4, 1); stubManager.Write("\n");
+ Fpga_Read_Reg(FPGA1, F1_Prescaler1_reg5, 1); stubManager.Write("\n");
+ Fpga_Read_Reg(FPGA1, F1_Prescaler1_reg6, 1); stubManager.Write("\n");
+ Fpga_Read_Reg(FPGA1, F1_Prescaler1_reg7, 1); stubManager.Write("\n");
+ Fpga_Read_Reg(FPGA1, F1_Prescaler1_reg8, 1); stubManager.Write("\n");
+
+ Fpga_Read_Reg(FPGA1, F1_Prescaler1_reg5, 1); stubManager.Write("\n");
+ Fpga_Read_Reg(FPGA2, F2_Prescaler1_reg10, 1); stubManager.Write("\n");
+ Fpga_Read_Reg(FPGA2, F2_Prescaler1_reg11, 1); stubManager.Write("\n");
+ Fpga_Read_Reg(FPGA2, F2_Prescaler1_reg12, 1); stubManager.Write("\n");
+ Fpga_Read_Reg(FPGA2, F2_Prescaler1_reg13, 1); stubManager.Write("\n");
+ Fpga_Read_Reg(FPGA3, F3_Prescaler1_reg9, 1); stubManager.Write("\n");
+
+ Fpga_Write_Reg(FPGA1, F1_Prescaler1_reg5, 0x00fa, 1);stubManager.Write("\n");
+ Fpga_Write_Reg(FPGA2, F2_Prescaler1_reg10, 0x00fa, 1);stubManager.Write("\n");
+ Fpga_Write_Reg(FPGA2, F2_Prescaler1_reg11, 0x00fa, 1);stubManager.Write("\n");
+ Fpga_Write_Reg(FPGA2, F2_Prescaler1_reg12, 0x00fa, 1);stubManager.Write("\n");
+ Fpga_Write_Reg(FPGA2, F2_Prescaler1_reg13, 0x00fa, 1);stubManager.Write("\n");
+ Fpga_Write_Reg(FPGA3, F3_Prescaler1_reg9, 0x00fa, 1);stubManager.Write("\n");
+
+ Fpga_Write_Reg(FPGA1, F1_Prescaler1_reg1, 0x00fa, 1);stubManager.Write("\n");
+ Fpga_Write_Reg(FPGA1, F1_Prescaler1_reg2, 0x00fa, 1);stubManager.Write("\n");
+ Fpga_Write_Reg(FPGA1, F1_Prescaler1_reg3, 0x00fa, 1);stubManager.Write("\n");
+ Fpga_Write_Reg(FPGA1, F1_Prescaler1_reg4, 0x00fa, 1);stubManager.Write("\n");
+ Fpga_Write_Reg(FPGA1, F1_Prescaler1_reg6, 0x00fa, 1);stubManager.Write("\n");
+ Fpga_Write_Reg(FPGA1, F1_Prescaler1_reg7, 0x00fa, 1);stubManager.Write("\n");
+ Fpga_Write_Reg(FPGA1, F1_Prescaler1_reg8, 0x00fa, 1);stubManager.Write("\n");
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Fpga_Read_Reg(FPGA1, F1_Prescaler1_reg5, 1); stubManager.Write("\n");
+ Fpga_Read_Reg(FPGA2, F2_Prescaler1_reg10, 1); stubManager.Write("\n");
+ Fpga_Read_Reg(FPGA2, F2_Prescaler1_reg11, 1); stubManager.Write("\n");
+ Fpga_Read_Reg(FPGA2, F2_Prescaler1_reg12, 1); stubManager.Write("\n");
+ Fpga_Read_Reg(FPGA2, F2_Prescaler1_reg13, 1); stubManager.Write("\n");
+
+
+
+
+
+
+ for (int i = 0; i<1000; i++)
+ {
+ stubManager.Write("----------------------------------------\n");
+ Fpga_Read_Reg(FPGA1, F1_Tacho_reg0, 1); stubManager.Write("\n");
+ Fpga_Read_Reg(FPGA1, F1_Tacho_reg1, 1); stubManager.Write("\n");
+ Fpga_Read_Reg(FPGA1, F1_Tacho_reg2, 1); stubManager.Write("\n");
+ Fpga_Read_Reg(FPGA1, F1_Tacho_reg3, 1); stubManager.Write("\n");
+ Fpga_Read_Reg(FPGA1, F1_Tacho_reg4, 1); stubManager.Write("\n");
+ Fpga_Read_Reg(FPGA1, F1_Tacho_reg5, 1); stubManager.Write("\n");
+ Fpga_Read_Reg(FPGA1, F1_Tacho_reg6, 1); stubManager.Write("\n");
+ Fpga_Read_Reg(FPGA1, F1_Tacho_reg7, 1); stubManager.Write("\n");
+ Fpga_Read_Reg(FPGA2, F2_Tacho_reg0, 1); stubManager.Write("\n");
+
+ //stubManager.Write("\n\n");
+ Thread.Sleep(1000);
+ }
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Header/header_LimitSwitch.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Header/header_LimitSwitch.cs
new file mode 100644
index 000000000..4454e9c63
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/Header/header_LimitSwitch.cs
@@ -0,0 +1,48 @@
+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 "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)
+{
+
+ uint Temp = 0;
+ int counter = 0;
+ stubManager.Write("\nReading register F1_LS_01_Direct: ");
+ var RetVal = Fpga_Read_Reg(FPGA1, F1_LS_01_Direct, 0);
+ stubManager.WriteHex(RetVal.Value,4);
+ Temp = RetVal.Value;
+ stubManager.Write("\nActivate limit switches one-by-one");
+
+ while ( counter != 10000)
+ {
+ RetVal = Fpga_Read_Reg(FPGA1, F1_LS_01_Direct, 0);
+ if (RetVal.Value != Temp)
+ {
+ stubManager.Write("\nRegister F1_LS_01_Direct new value: ");
+ stubManager.WriteHex(RetVal.Value,4);
+ counter = counter + 1;
+ }
+ Thread.Sleep(100);
+ Temp = RetVal.Value;
+
+ }
+
+
+
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Header/magner_ssr.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Header/magner_ssr.cs
new file mode 100644
index 000000000..56e8ee848
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/Header/magner_ssr.cs
@@ -0,0 +1,67 @@
+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 "Tango_Defines_SSR.cs"
+//include "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\Software\Stub_scripts\Tango_Defines_Basic.cs"
+//include "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\Software\Stub_scripts\Interfaces\Tango_Defines_SSR.cs"
+
+
+public void OnExecute(StubManager stubManager)
+{
+Int32 Bit = 1;
+
+ //Write GPO_DRYER_SSR1_CTRL SSR/SSR no. 1
+ SetBit (FPGA2, F2_CTRL, 0, 1);
+ stubManager.Write("\nTesting SSR no. 13 of magnet");
+ Thread.Sleep(4000);
+
+var response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,2, true, 50);
+
+
+ stubManager.Write("\n*** Open Lid Head ");
+ Bit = 1;
+
+ while (Bit != 0x0) //wait until LTFU LOADRAM Down
+ {
+ Bit = GetBit(FPGA1, F1_LS_01_Direct,7);
+ Thread.Sleep(10);
+ }
+ Thread.Sleep(100);
+ stubManager.Write("\n--------1--------");
+
+
+ stubManager.Write("\n*** Close Lid Head ");
+ Bit = 1;
+ response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,2, false, 50);
+
+ while (Bit != 0x0) //wait until LTFU LOADRAM Down
+ {
+ Bit = GetBit(FPGA1, F1_LS_01_Direct,8);
+ Thread.Sleep(10);
+ }
+ Thread.Sleep(100);
+ stubManager.Write("\n--------2--------");
+
+ response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,2, true, 0);
+
+ SetBit (FPGA2, F2_CTRL, 0, 0);
+
+
+// var response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,0, true, 50); motor clean
+
+//response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,1, true, 50); motor clean
+
+
+
+
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/LTFU/LTFU_LimitSwitch.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/LTFU/LTFU_LimitSwitch.cs
new file mode 100644
index 000000000..e637e7a6a
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/LTFU/LTFU_LimitSwitch.cs
@@ -0,0 +1,48 @@
+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 "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)
+{
+
+ uint Temp = 0;
+ int counter = 0;
+ stubManager.Write("\nReading register F1_LS_02_Direct: ");
+ var RetVal = Fpga_Read_Reg(FPGA1, F1_LS_02_Direct, 0);
+ stubManager.WriteHex(RetVal.Value,4);
+ Temp = RetVal.Value;
+ stubManager.Write("\nActivate limit switches one-by-one");
+
+ while ( counter != 100)
+ {
+ RetVal = Fpga_Read_Reg(FPGA1, F1_LS_02_Direct, 0);
+ if (RetVal.Value != Temp)
+ {
+ stubManager.Write("\nRegister F1_LS_02_Direct new value: ");
+ stubManager.WriteHex(RetVal.Value,4);
+ counter = counter + 1;
+ }
+ Thread.Sleep(100);
+ Temp = RetVal.Value;
+
+ }
+
+
+
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/LTFU/LTFU_Motors.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/LTFU/LTFU_Motors.cs
new file mode 100644
index 000000000..35e733a82
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/LTFU/LTFU_Motors.cs
@@ -0,0 +1,79 @@
+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 "Tango_Defines_Motors.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_Motors.cs"
+
+
+public void OnExecute(StubManager stubManager)
+{
+
+ stubManager.Write("\n\n*** LTFU Motor Test ***\n");
+
+ stubManager.Write("\n*** Pulling motor drivers out of reset\n");
+ SetBit(FPGA1, F1_Moto_Driver_NSTBYRST1, 0, 1);
+ SetBit(FPGA1, F1_Moto_Driver_NSTBYRST1, 1, 1);
+ SetBit(FPGA1, F1_Moto_Driver_NSTBYRST1, 2, 1);
+ SetBit(FPGA1, F1_Moto_Driver_NSTBYRST1, 4, 1);
+
+
+ //Place in high-Z state
+ stubManager.Write("\n*** Place in high-Z state\n");
+ Motor_HighZ(FPGA1, F1_MOTO_LDRIVING_TX1, F1_MOTO_LDRIVING_TX0);
+ Motor_HighZ(FPGA1, F1_MOTO_LLOADING_TX1, F1_MOTO_LLOADING_TX0);
+ Motor_HighZ(FPGA1, F1_MOTO_LDANCER1_TX1, F1_MOTO_LDANCER1_TX0);
+ //Motor_HighZ(FPGA1, F1_MOTO_LDANCER2_TX1, F1_MOTO_LDANCER2_TX0);
+ Motor_HighZ(FPGA1, F1_MOTO_LPIVOT1_TX1, F1_MOTO_LPIVOT1_TX0);
+
+ /*
+ Motor_ReadCfg(FPGA1, F1_MOTO_LDRIVING_TX1, F1_MOTO_LDRIVING_TX0);
+ Motor_ReadCfg(FPGA1, F1_MOTO_LLOADING_TX1, F1_MOTO_LLOADING_TX0);
+ Motor_ReadCfg(FPGA1, F1_MOTO_LDANCER1_TX1, F1_MOTO_LDANCER1_TX0);
+ Motor_ReadCfg(FPGA1, F1_MOTO_LDANCER2_TX1, F1_MOTO_LDANCER2_TX0);
+ Motor_ReadCfg(FPGA1, F1_MOTO_LPIVOT1_TX1, F1_MOTO_LPIVOT1_TX0)
+ */
+
+ stubManager.Write("\n*** Running motor F1_MOTO_LDRIVING for 4 seconds... ");
+ Motor_Run(FPGA1, F1_MOTO_LDRIVING_TX1, F1_MOTO_LDRIVING_TX0, 0xffff, 0x1);
+ Thread.Sleep(4000);
+ Motor_HighZ(FPGA1, F1_MOTO_LDRIVING_TX1, F1_MOTO_LDRIVING_TX0);
+ stubManager.Write("\n*** Stopped motor F1_MOTO_LDRIVING");
+
+
+ stubManager.Write("\n\n*** Moving motor F1_MOTO_LLOADING back and for for 4 times...");
+ Motor_Move_Loop(FPGA1, F1_MOTO_LLOADING_TX1, F1_MOTO_LLOADING_TX0, 0x3200, 0x1, 4);
+ Motor_HighZ(FPGA1, F1_MOTO_LLOADING_TX1, F1_MOTO_LLOADING_TX0);
+ stubManager.Write("\n*** Stopped motor F1_MOTO_LLOADING");
+
+ stubManager.Write("\n\n*** Moving motor F1_MOTO_LDANCER1 back and for for 4 times...");
+ Motor_Move_Loop(FPGA1, F1_MOTO_LDANCER1_TX1, F1_MOTO_LDANCER1_TX0, 0x3200, 0x1, 4);
+ Motor_HighZ(FPGA1, F1_MOTO_LDANCER1_TX1, F1_MOTO_LDANCER1_TX0);
+ stubManager.Write("\n*** Stopped motor F1_MOTO_LDANCER1");
+
+ /*
+ stubManager.Write("\n\n*** Moving motor F1_MOTO_LDANCER2 back and for for 4 times...");
+ Motor_Move_Loop(FPGA1, F1_MOTO_LDANCER2_TX1, F1_MOTO_LDANCER2_TX0, 0x3200, 0x1, 4);
+ Motor_HighZ(FPGA1, F1_MOTO_LDANCER2_TX1, F1_MOTO_LDANCER2_TX0);
+ stubManager.Write("\n*** Stopped motor F1_MOTO_LDANCER2");
+ */
+
+ stubManager.Write("\n\n*** Moving motor F1_MOTO_LPIVOT1 back and for for 4 times...");
+ Motor_Move_Loop(FPGA1, F1_MOTO_LPIVOT1_TX1, F1_MOTO_LPIVOT1_TX0, 0x3200, 0x1, 4);
+ Motor_HighZ(FPGA1, F1_MOTO_LPIVOT1_TX1, F1_MOTO_LPIVOT1_TX0);
+ stubManager.Write("\n*** Stopped motor F1_MOTO_LPIVOT1");
+
+ stubManager.Write("\n\n*** RTFU Motor Test Ended ***");
+
+
+}
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/LTFU/LTFU_Motors_Switch.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/LTFU/LTFU_Motors_Switch.cs
new file mode 100644
index 000000000..7578e825d
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/LTFU/LTFU_Motors_Switch.cs
@@ -0,0 +1,113 @@
+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.Diagnostics;
+using Tango.PMR.Stubs;
+using Tango.Stubs;
+
+
+include "..\..\Defines\Tango_Defines_Basic.cs"
+include "Tango_Defines_Motors.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_Motors.cs"
+
+
+
+public void OnExecute(StubManager stubManager)
+{
+
+ stubManager.Write("\n*** LTFU Motor + limit switch Test ***");
+// stubManager.Write("\n*** Pulling motor drivers out of reset");
+ SetBit(FPGA1, F1_Moto_Driver_NSTBYRST1, 0, 1);
+ SetBit(FPGA1, F1_Moto_Driver_NSTBYRST1, 1, 1);
+ SetBit(FPGA1, F1_Moto_Driver_NSTBYRST1, 2, 1);
+ SetBit(FPGA1, F1_Moto_Driver_NSTBYRST1, 4, 1);
+
+ stubManager.Write("\n*** F1_MOTO_LPIVOT1 is moving back and forth ");
+
+
+
+ //mov LLOAD - up
+ stubManager.Write("\n*** Moving motor F1_MOTO_LLOADING back and for");
+ MotorHomingRequest motorHomingRequest = new MotorHomingRequest();
+ motorHomingRequest.MotorType = (Tango.PMR.Hardware.HardwareMotorType) 19;
+ motorHomingRequest.Speed = 500;
+ motorHomingRequest.Direction = Tango.PMR.Diagnostics.MotorDirection.Forward; //Forward
+ stubManager.Run(motorHomingRequest);
+ Thread.Sleep(6000);
+ //mov lLOAD - dn
+ motorHomingRequest.MotorType = (Tango.PMR.Hardware.HardwareMotorType) 19;
+ motorHomingRequest.Speed = 500;
+ motorHomingRequest.Direction = Tango.PMR.Diagnostics.MotorDirection.Backward; //Forward
+ stubManager.Run(motorHomingRequest);
+ Thread.Sleep(5000);
+ var response = stubManager.Run<StubMotorMovResponse>("StubMotorMovRequest" ,19, false, 1000);
+ Thread.Sleep(1000);
+
+
+ //mov ldriving -
+ stubManager.Write("\n*** Running motor F1_MOTO_LDRIVING for 4 seconds... ");
+ Motor_Run(FPGA1, F1_MOTO_LDRIVING_TX1, F1_MOTO_LDRIVING_TX0, 0xffff, 0x1);
+// Thread.Sleep(4000);
+ Motor_HighZ(FPGA1, F1_MOTO_LDRIVING_TX1, F1_MOTO_LDRIVING_TX0);
+
+
+ //mov Ldancer -
+ stubManager.Write("\n*** F1_MOTO_LDANCER1 is moving back and forth ");
+ motorHomingRequest.MotorType = (Tango.PMR.Hardware.HardwareMotorType) 16;
+ motorHomingRequest.Speed = 500;
+ motorHomingRequest.Direction = Tango.PMR.Diagnostics.MotorDirection.Forward; //Forward
+ stubManager.Run(motorHomingRequest);
+ Thread.Sleep(20000);
+ motorHomingRequest.MotorType = (Tango.PMR.Hardware.HardwareMotorType) 16;
+ motorHomingRequest.Speed = 500;
+ motorHomingRequest.Direction = Tango.PMR.Diagnostics.MotorDirection.Backward; //Backard
+ stubManager.Run(motorHomingRequest);
+ Thread.Sleep(20000);
+
+
+
+ //mov Lpivot -
+ stubManager.Write("\n*** F1_MOTO_LPIVOT1 is moving back and forth ");
+ motorHomingRequest.MotorType = (Tango.PMR.Hardware.HardwareMotorType) 20;
+ motorHomingRequest.Speed = 500;
+ motorHomingRequest.Direction = Tango.PMR.Diagnostics.MotorDirection.Forward; //Forward
+ stubManager.Run(motorHomingRequest);
+ Thread.Sleep(20000);
+ motorHomingRequest.MotorType = (Tango.PMR.Hardware.HardwareMotorType) 20;
+ motorHomingRequest.Speed = 500;
+ motorHomingRequest.Direction = Tango.PMR.Diagnostics.MotorDirection.Backward; //Backard
+ stubManager.Run(motorHomingRequest);
+ Thread.Sleep(20000);
+
+
+
+
+
+
+
+
+
+ stubManager.Write("\n*** F1_MOTO_RDANCER is moving back and forth ");
+ motorHomingRequest.MotorType = (Tango.PMR.Hardware.HardwareMotorType) 21;
+ motorHomingRequest.Speed = 10;
+// motorHomingRequest.Direction = Tango.PMR.Diagnostics.MotorDirection.Forward; //Forward
+// stubManager.Run(motorHomingRequest);
+// Thread.Sleep(5000);
+ motorHomingRequest.MotorType = (Tango.PMR.Hardware.HardwareMotorType) 21;
+ motorHomingRequest.Speed = 10;
+// motorHomingRequest.Direction = Tango.PMR.Diagnostics.MotorDirection.Backward; //Backard
+// stubManager.Run(motorHomingRequest);
+// Thread.Sleep(4000);
+
+ stubManager.Write("\n\n*** RTFU Motor Test Ended ***");
+
+
+
+}
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/LTFU/LTFU_Motors_Switch1.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/LTFU/LTFU_Motors_Switch1.cs
new file mode 100644
index 000000000..9955e0e5d
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/LTFU/LTFU_Motors_Switch1.cs
@@ -0,0 +1,208 @@
+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.Diagnostics;
+using Tango.PMR.Stubs;
+using Tango.Stubs;
+
+
+include "..\..\Defines\Tango_Defines_Basic.cs"
+include "Tango_Defines_Motors.cs"
+include "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_Motors.cs"
+
+
+
+public void OnExecute(StubManager stubManager)
+{
+Int32 Bit = 1;
+ stubManager.Write("\n*** LTFU Motor + limit switch Test ***");
+ SetBit(FPGA1, F1_Moto_Driver_NSTBYRST1, 0, 1);
+ SetBit(FPGA1, F1_Moto_Driver_NSTBYRST1, 1, 1);
+ SetBit(FPGA1, F1_Moto_Driver_NSTBYRST1, 2, 1);
+ SetBit(FPGA1, F1_Moto_Driver_NSTBYRST1, 4, 1);
+
+ stubManager.Write("\n*** Moving motor F1_MOTO_LLOADING back and for");
+ Bit = 1;
+
+ var response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,19,true , 500);
+ while (Bit != 0x0) //wait until LTFU LOADRAM Down
+ {
+ Bit = GetBit(FPGA1, F1_LS_02_Direct,8);
+ Thread.Sleep(10);
+ }
+ Thread.Sleep(100);
+ stubManager.Write("\n--------1--------");
+
+
+response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,19, false, 500);
+ Bit = 1;
+ while (Bit != 0x0) //wait until LTFU LOADRAM Down
+ {
+ Bit = GetBit(FPGA1, F1_LS_02_Direct,9);
+ Thread.Sleep(10);
+ }
+ stubManager.Write("\n--------2--------");
+ response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,19, false, 0);
+
+ Thread.Sleep(100);
+ var response1 = stubManager.Run<StubMotorMovResponse>("StubMotorMovRequest" ,19, false, 5000);
+ Thread.Sleep(1000);
+ Motor_HighZ(FPGA1, F1_MOTO_LLOADING_TX1, F1_MOTO_LLOADING_TX0);
+ stubManager.Write("\n*** Stopped motor F1_MOTO_LLOADING");
+
+
+ //mov ldriving -
+ stubManager.Write("\n*** Running motor F1_MOTO_LDRIVING for 4 seconds... ");
+ Motor_Run(FPGA1, F1_MOTO_LDRIVING_TX1, F1_MOTO_LDRIVING_TX0, 0xffff, 0x1);
+ Thread.Sleep(4000);
+ Motor_HighZ(FPGA1, F1_MOTO_LDRIVING_TX1, F1_MOTO_LDRIVING_TX0);
+
+
+
+
+
+
+
+
+ stubManager.Write("\n\n*** Moving motor F1_MOTO_LDANCER1 back and for ...");
+
+ Bit = 1;
+ response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,16,false ,500);
+ while (Bit != 0x0) //wait until LTFU LOADRAM Down
+ {
+ Bit = GetBit(FPGA1, F1_LS_02_Direct,12);
+ Thread.Sleep(10);
+ }
+ Thread.Sleep(100);
+ stubManager.Write("\n--------1--------");
+
+
+response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,16, true, 500);
+ Bit = 1;
+ while (Bit != 0x0) //wait until LTFU LOADRAM Down
+ {
+ Bit = GetBit(FPGA1, F1_LS_02_Direct,13);
+ Thread.Sleep(10);
+ }
+
+ Thread.Sleep(1000);
+ Motor_HighZ(FPGA1, F1_MOTO_LDANCER1_TX1, F1_MOTO_LDANCER1_TX0);
+
+
+
+
+
+/*
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ //mov LLOAD - up
+ stubManager.Write("\n*** Moving motor F1_MOTO_LLOADING back and for");
+ MotorHomingRequest motorHomingRequest = new MotorHomingRequest();
+ motorHomingRequest.MotorType = (Tango.PMR.Hardware.HardwareMotorType) 19;
+ motorHomingRequest.Speed = 500;
+ motorHomingRequest.Direction = Tango.PMR.Diagnostics.MotorDirection.Forward; //Forward
+ stubManager.Run(motorHomingRequest);
+ Thread.Sleep(6000);
+ //mov lLOAD - dn
+ motorHomingRequest.MotorType = (Tango.PMR.Hardware.HardwareMotorType) 19;
+ motorHomingRequest.Speed = 500;
+ motorHomingRequest.Direction = Tango.PMR.Diagnostics.MotorDirection.Backward; //Forward
+ stubManager.Run(motorHomingRequest);
+ Thread.Sleep(5000);
+ var response = stubManager.Run<StubMotorMovResponse>("StubMotorMovRequest" ,19, false, 1000);
+ Thread.Sleep(1000);
+
+
+ //mov ldriving -
+ stubManager.Write("\n*** Running motor F1_MOTO_LDRIVING for 4 seconds... ");
+ Motor_Run(FPGA1, F1_MOTO_LDRIVING_TX1, F1_MOTO_LDRIVING_TX0, 0xffff, 0x1);
+// Thread.Sleep(4000);
+ Motor_HighZ(FPGA1, F1_MOTO_LDRIVING_TX1, F1_MOTO_LDRIVING_TX0);
+
+
+ //mov Ldancer -
+ stubManager.Write("\n*** F1_MOTO_LDANCER1 is moving back and forth ");
+ motorHomingRequest.MotorType = (Tango.PMR.Hardware.HardwareMotorType) 16;
+ motorHomingRequest.Speed = 500;
+ motorHomingRequest.Direction = Tango.PMR.Diagnostics.MotorDirection.Forward; //Forward
+ stubManager.Run(motorHomingRequest);
+ Thread.Sleep(20000);
+ motorHomingRequest.MotorType = (Tango.PMR.Hardware.HardwareMotorType) 16;
+ motorHomingRequest.Speed = 500;
+ motorHomingRequest.Direction = Tango.PMR.Diagnostics.MotorDirection.Backward; //Backard
+ stubManager.Run(motorHomingRequest);
+ Thread.Sleep(20000);
+
+
+
+ //mov Lpivot -
+ stubManager.Write("\n*** F1_MOTO_LPIVOT1 is moving back and forth ");
+ motorHomingRequest.MotorType = (Tango.PMR.Hardware.HardwareMotorType) 20;
+ motorHomingRequest.Speed = 500;
+ motorHomingRequest.Direction = Tango.PMR.Diagnostics.MotorDirection.Forward; //Forward
+ stubManager.Run(motorHomingRequest);
+ Thread.Sleep(20000);
+ motorHomingRequest.MotorType = (Tango.PMR.Hardware.HardwareMotorType) 20;
+ motorHomingRequest.Speed = 500;
+ motorHomingRequest.Direction = Tango.PMR.Diagnostics.MotorDirection.Backward; //Backard
+ stubManager.Run(motorHomingRequest);
+ Thread.Sleep(20000);
+
+
+
+
+
+
+
+
+
+ stubManager.Write("\n*** F1_MOTO_RDANCER is moving back and forth ");
+ motorHomingRequest.MotorType = (Tango.PMR.Hardware.HardwareMotorType) 21;
+ motorHomingRequest.Speed = 10;
+// motorHomingRequest.Direction = Tango.PMR.Diagnostics.MotorDirection.Forward; //Forward
+// stubManager.Run(motorHomingRequest);
+// Thread.Sleep(5000);
+ motorHomingRequest.MotorType = (Tango.PMR.Hardware.HardwareMotorType) 21;
+ motorHomingRequest.Speed = 10;
+// motorHomingRequest.Direction = Tango.PMR.Diagnostics.MotorDirection.Backward; //Backard
+// stubManager.Run(motorHomingRequest);
+// Thread.Sleep(4000);
+
+ stubManager.Write("\n\n*** RTFU Motor Test Ended ***");
+ */
+
+
+}
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/LTFU/LTFU_SSI.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/LTFU/LTFU_SSI.cs
new file mode 100644
index 000000000..3218dbd83
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/LTFU/LTFU_SSI.cs
@@ -0,0 +1,48 @@
+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 "Tango_Defines_SSI.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_SSI.cs"
+
+
+public void OnExecute(StubManager stubManager)
+{
+ int k = 0;
+ Fpga_Read_Reg(FPGA1, F1_Prescaler1_reg1, 0);
+ Fpga_Read_Reg(FPGA1, F1_Prescaler1_reg2, 0);
+
+ //Set output clock frequency to about 200 kHz
+ Fpga_Write_Reg(FPGA1, F1_Prescaler1_reg1, 0x0024, 0);
+ Fpga_Write_Reg(FPGA1, F1_Prescaler1_reg2, 0x0024, 0);
+
+ Fpga_Read_Reg(FPGA1, F1_Prescaler1_reg1, 0);
+ Fpga_Read_Reg(FPGA1, F1_Prescaler1_reg2, 0);
+
+ for (int i = 0; i < 100; i++)
+ {
+
+ SSI_Read_Write(FPGA1, F1_LDANCER1_ROTENC_MSB, F1_LDANCER1_ROTENC_LSB, F1_LDANCER1_ROTENC_TX);
+ SSI_Read_Write(FPGA1, F1_LDANCER2_ROTENC_MSB, F1_LDANCER2_ROTENC_LSB, F1_LDANCER2_ROTENC_TX);
+ stubManager.Write("\n");
+ k++;
+ if ( (k & 0x8) == 0x08 ) {
+ k = 0;
+ stubManager.Write(" LDANCER1 LDANCER2 \n");
+ }
+
+ Thread.Sleep(400);
+ }
+
+
+}
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/LTFU/test.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/LTFU/test.cs
new file mode 100644
index 000000000..397c6fbd4
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/LTFU/test.cs
@@ -0,0 +1,25 @@
+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 "Tango_Defines_LimitSwitch.cs"
+
+public void OnExecute(StubManager stubManager)
+{
+ Int32 Bit = 1;
+
+ //Write GPO_DRYER_SSR1_CTRL SSR/SSR no. 1
+ SetBit (FPGA2, F2_CTRL, 0, 1);
+ stubManager.Write("\nTesting SSR no. 13 of magnet");
+ Thread.Sleep(4000);
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/MidTank/Midtank_Valves.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/MidTank/Midtank_Valves.cs
new file mode 100644
index 000000000..d809e0a6a
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/MidTank/Midtank_Valves.cs
@@ -0,0 +1,80 @@
+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_GPO.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_GPO.cs"
+
+
+public void OnExecute(StubManager stubManager)
+{
+ int loop =1;
+ int midtankno = 0;
+while(loop!=0)
+ {
+ var response = stubManager.ShowResponseWindow("Enter Midtank number to test (1-8): press 9 to quit ", "");
+ //stubManager.WriteLine(response);
+ stubManager.Write("\n");
+ midtankno = int.Parse(response);
+
+switch (midtankno)
+ {
+ case 1:
+ midtankno=1;
+ break;
+ case 2:
+ midtankno=3;
+ break;
+ case 3:
+ midtankno=5;
+ break;
+ case 4:
+ midtankno=7;
+ break;
+ case 5:
+ midtankno=2;
+ break;
+ case 6:
+ midtankno=4;
+ break;
+ case 7:
+ midtankno=6;
+ break;
+ case 8:
+ midtankno=8;
+ break;
+ case 9:
+ loop=8;
+ break;
+
+
+ }
+
+
+
+ SetBit (FPGA3, F3_VALVE_OUT,8- midtankno, 1);
+ stubManager.Write("\n\nSetting GPO F3_VALVE_OUT, bit "); stubManager.Write(8-midtankno); stubManager.Write(", "); stubManager.Write(F3_VALVE_Bits[8-midtankno]);
+ Thread.Sleep(1000);
+ SetBit (FPGA3, F3_VALVE_OUT,8- midtankno, 0);
+ stubManager.Write("\nClearing GPO F3_VALVE_OUT, bit "); stubManager.Write(8-midtankno); stubManager.Write(", "); stubManager.Write(F3_VALVE_Bits[8-midtankno]);
+ Thread.Sleep(1000);
+
+ SetBit (FPGA3, F3_VALVE_OUT, 16-midtankno, 1);
+ stubManager.Write("\n\nSetting GPO F3_VALVE_OUT, bit "); stubManager.Write(16-midtankno); stubManager.Write(", "); stubManager.Write(F3_VALVE_Bits[16-midtankno]);
+ Thread.Sleep(1000);
+ SetBit (FPGA3, F3_VALVE_OUT, 16-midtankno, 0);
+ stubManager.Write("\nClearing GPO F3_VALVE_OUT, bit "); stubManager.Write(16-midtankno); stubManager.Write(", "); stubManager.Write(F3_VALVE_Bits[16-midtankno]);
+ Thread.Sleep(1000);
+}
+
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/MidTank/Midtank_pressure_sensors.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/MidTank/Midtank_pressure_sensors.cs
new file mode 100644
index 000000000..682ef322d
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/MidTank/Midtank_pressure_sensors.cs
@@ -0,0 +1,172 @@
+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 I2C_ID = 2;
+//const Int32 I2C_Slave_Add = 0x46; //must be 0x40, 0x44 or 0x46
+//----------------------
+
+int adc_configuration(uint I2C_Slave_Add,uint channel )
+ {
+ StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest();
+ stubI2CWriteBytesRequest.I2CId = I2C_ID;
+ stubI2CWriteBytesRequest.SlaveAddress = I2C_Slave_Add;
+
+ UInt32 uInt32 = new UInt32();
+ stubI2CWriteBytesRequest.BytesTWrite.Add(0x00);//Byte 0 to write
+ stubI2CWriteBytesRequest.BytesTWrite.Add(channel);//Byte 1 to Write, must be 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02 or 0x01 for different channels
+ stubI2CWriteBytesRequest.BytesTWrite.Add(0x80);//Byte 2 to Write
+
+ var response = stubManager.Run<StubI2CWriteBytesResponse>(stubI2CWriteBytesRequest);
+
+ return 1;
+ }
+
+
+
+
+int adc_set_for_read_temp(uint I2C_Slave_Add)
+ {
+ StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest();
+ stubI2CWriteBytesRequest.I2CId = I2C_ID;
+ stubI2CWriteBytesRequest.SlaveAddress = I2C_Slave_Add;
+
+ UInt32 uInt32 = new UInt32();
+ stubI2CWriteBytesRequest.BytesTWrite.Add(0x02);//Byte 0 to write
+
+ var response = stubManager.Run<StubI2CWriteBytesResponse>(stubI2CWriteBytesRequest);
+
+ return 1;
+ }
+
+
+
+
+int adc_read_temp(uint I2C_Slave_Add)
+ {
+
+ StubI2CReadBytesRequest stubI2CReadBytesRequest = new StubI2CReadBytesRequest();
+ stubI2CReadBytesRequest.I2CId = I2C_ID;
+ stubI2CReadBytesRequest.SlaveAddress = I2C_Slave_Add;
+ stubI2CReadBytesRequest.NumberOfBytesToRead = 2; // Number of bytes to read
+
+ var response1 = stubManager.Run<StubI2CReadBytesResponse>(stubI2CReadBytesRequest);
+
+ for(int i=0; i<stubI2CReadBytesRequest.NumberOfBytesToRead;i++)
+ {
+ stubManager.WriteLineHex(response1.ReadBytes[i],2);
+ }
+
+
+ return 1;
+ }
+
+
+
+
+int adc_set_for_read_ch(uint I2C_Slave_Add)
+ {
+ StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest();
+ stubI2CWriteBytesRequest.I2CId = I2C_ID;
+ stubI2CWriteBytesRequest.SlaveAddress = I2C_Slave_Add;
+
+ UInt32 uInt32 = new UInt32();
+ stubI2CWriteBytesRequest.BytesTWrite.Add(0x01);//Byte 0 to write
+
+ var response = stubManager.Run<StubI2CWriteBytesResponse>(stubI2CWriteBytesRequest);
+
+ return 1;
+ }
+
+
+int adc_read_ch(uint I2C_Slave_Add)
+ {
+ StubI2CReadBytesRequest stubI2CReadBytesRequest = new StubI2CReadBytesRequest();
+ stubI2CReadBytesRequest.I2CId = I2C_ID;
+ stubI2CReadBytesRequest.SlaveAddress = I2C_Slave_Add;
+ stubI2CReadBytesRequest.NumberOfBytesToRead = 2; // Number of bytes to read
+
+ var response1 = stubManager.Run<StubI2CReadBytesResponse>(stubI2CReadBytesRequest);
+ uint temph=0;
+ uint templ=0;
+ uint temp;
+ for(int i=0; i<stubI2CReadBytesRequest.NumberOfBytesToRead;i=i+2)
+ {
+ temph=response1.ReadBytes[i];
+ templ=response1.ReadBytes[i+1];
+ temp = (temph << 8) | templ;
+ temp=temp & 0x0fff;
+ stubManager.WriteHex(temp,4);
+
+ }
+
+ return 1;
+ }
+
+
+public void OnExecute(StubManager stubManager)
+{
+ for (int i = 0; i<100; i++)
+ {
+
+
+ stubManager.Write("\n-----------MIDTANK_PRESSESENS----------- ");
+
+ stubManager.Write("\n1_1= ");
+ adc_configuration(0x44,0x20); //a2d_address 0x44 channel channel 2
+// adc_set_for_read_temp(0x44);
+// adc_read_temp(0x44);
+ adc_set_for_read_ch(0x44);
+ adc_read_ch(0x44);
+
+ stubManager.Write("\n1_2= ");
+ adc_configuration(0x44,0x10); //a2d_address 0x44 channel channel 3
+ adc_set_for_read_ch(0x44);
+ adc_read_ch(0x44);
+
+ stubManager.Write("\n2_1= ");
+ adc_configuration(0x44,0x08); //a2d_address 0x44 channel channel 4
+ adc_set_for_read_ch(0x44);
+ adc_read_ch(0x44);
+
+ stubManager.Write("\n2_2= ");
+ adc_configuration(0x44,0x04); //a2d_address 0x44 channel channel 5
+ adc_set_for_read_ch(0x44);
+ adc_read_ch(0x44);
+
+ stubManager.Write("\n3_1= ");
+ adc_configuration(0x46,0x80); //a2d_address 0x46 channel channel 0
+ adc_set_for_read_ch(0x46);
+ adc_read_ch(0x46);
+
+ stubManager.Write("\n3_2= ");
+ adc_configuration(0x46,0x40); //a2d_address 0x46 channel channel 1
+ adc_set_for_read_ch(0x46);
+ adc_read_ch(0x46);
+
+ stubManager.Write("\n4_1= ");
+ adc_configuration(0x46,0x20); //a2d_address 0x46 channel channel 2
+ adc_set_for_read_ch(0x46);
+ adc_read_ch(0x46);
+
+
+ stubManager.Write("\n4_2= ");
+ adc_configuration(0x46,0x10); //a2d_address 0x46 channel channel 3
+ adc_set_for_read_ch(0x46);
+ adc_read_ch(0x46);
+
+ Thread.Sleep(1000);
+
+ }
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Other/All_PT100.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Other/All_PT100.cs
new file mode 100644
index 000000000..bc338adb2
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/Other/All_PT100.cs
@@ -0,0 +1,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;
+
+include "..\..\Defines\Tango_Defines_Basic.cs"
+include "Tango_Defines_PT100.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_PT100.cs"
+
+
+Int32 ADS1220_Setup(Int32 Fpga, Int32 HighAdr, Int32 LowAdr, Int32 BusyBitNo)
+{
+ ADS1220_Reset(Fpga, HighAdr, LowAdr);
+ ADS1220_WriteReg(Fpga, HighAdr, LowAdr, 0x0, 0x08);
+ //ADS1220_WriteReg(Fpga, HighAdr, LowAdr, 0x1, 0x04); //Continuous mode
+ ADS1220_WriteReg(Fpga, HighAdr, LowAdr, 0x1, 0x00); //Single shot mode
+ ADS1220_WriteReg(Fpga, HighAdr, LowAdr, 0x2, 0x55);
+ ADS1220_WriteReg(Fpga, HighAdr, LowAdr, 0x3, 0x70);
+ //ADS1220_StartSync(Fpga, HighAdr, LowAdr);
+ return 1;
+}
+
+
+Int32 ADS1220_ConvertionProcess(Int32 Fpga, Int32 HighAdr, Int32 LowAdr, Int32 BusyBitNo)
+{
+ Int32 rv;
+
+ ADS1220_StartSync(Fpga, HighAdr, LowAdr);
+ Thread.Sleep(100);
+ //rv = ADS1220_GetConvertion(Fpga, HighAdr, LowAdr, BusyBitNo);
+ rv = ADS1220_LoadOutReg(Fpga, HighAdr, LowAdr, BusyBitNo);
+ stubManager.WriteHex( rv ,8); stubManager.Write("\t");
+ return rv;
+}
+
+
+public void OnExecute(StubManager stubManager)
+{
+ int rv = 0;
+ int k = 0;
+
+
+ ADS1220_Setup(FPGA2, F2_ANALOG_DRYER_TEMP1_1_TX_01, F2_ANALOG_DRYER_TEMP1_1_TX_00, 0);
+ ADS1220_Setup(FPGA2, F2_ANALOG_DRYER_TEMP2_1_TX_01, F2_ANALOG_DRYER_TEMP2_1_TX_00, 1);
+ ADS1220_Setup(FPGA2, F2_ANALOG_DRYER_TEMP3_1_TX_01, F2_ANALOG_DRYER_TEMP3_1_TX_00, 2);
+
+ ADS1220_Setup(FPGA2, F2_ANALOG_DYEINGH_TEMP1_1_TX_01, F2_ANALOG_DYEINGH_TEMP1_1_TX_00, 3);
+ ADS1220_Setup(FPGA2, F2_ANALOG_DYEINGH_TEMP2_1_TX_01, F2_ANALOG_DYEINGH_TEMP2_1_TX_00, 4);
+ ADS1220_Setup(FPGA2, F2_ANALOG_DYEINGH_TEMP3_1_TX_01, F2_ANALOG_DYEINGH_TEMP3_1_TX_00, 5);
+
+ ADS1220_Setup(FPGA2, F2_ANALOG_DYEINGH_TEMP4_1_TX_01, F2_ANALOG_DYEINGH_TEMP4_1_TX_00, 6);
+ ADS1220_Setup(FPGA2, F2_ANALOG_DYEINGH_TEMP5_1_TX_01, F2_ANALOG_DYEINGH_TEMP5_1_TX_00, 7);
+ ADS1220_Setup(FPGA2, F2_ANALOG_MIXCHIP_TEMP_1_TX_01, F2_ANALOG_MIXCHIP_TEMP_1_TX_00, 8);
+
+ ADS1220_Setup(FPGA2, F2_AN_ENCLOSURETEMP1_1_TX_01, F2_AN_ENCLOSURETEMP1_1_TX_00, 9);
+ ADS1220_Setup(FPGA2, F2_AN_ENCLOSURETEMP2_1_TX_01, F2_AN_ENCLOSURETEMP2_1_TX_00, 10);
+ ADS1220_Setup(FPGA2, F2_AN_ENCLOSURETEMP3_1_TX_01, F2_AN_ENCLOSURETEMP3_1_TX_00, 11);
+ stubManager.Write("DRYER_TEMP1\tDRYER_TEMP2\tDRYER_TEMP3\tDYH_TEMP1\tDYH_TEMP2\tDYH_TEMP3\tDYH_TEMP4\tDYH_TEMP5\tMIX_TEMP\tENCTEMP1\tENCTEMP2\tENCTEMP3\n");
+
+ for (int i=0; i < 1000; i++)
+ {
+
+ rv = ADS1220_ConvertionProcess(FPGA2, F2_ANALOG_DRYER_TEMP1_1_TX_01, F2_ANALOG_DRYER_TEMP1_1_TX_00, 0);
+ rv = ADS1220_ConvertionProcess(FPGA2, F2_ANALOG_DRYER_TEMP2_1_TX_01, F2_ANALOG_DRYER_TEMP2_1_TX_00, 1);
+ rv = ADS1220_ConvertionProcess(FPGA2, F2_ANALOG_DRYER_TEMP3_1_TX_01, F2_ANALOG_DRYER_TEMP3_1_TX_00, 2);
+
+ rv = ADS1220_ConvertionProcess(FPGA2, F2_ANALOG_DYEINGH_TEMP1_1_TX_01, F2_ANALOG_DYEINGH_TEMP1_1_TX_00, 3);
+ rv = ADS1220_ConvertionProcess(FPGA2, F2_ANALOG_DYEINGH_TEMP2_1_TX_01, F2_ANALOG_DYEINGH_TEMP2_1_TX_00, 4);
+ rv = ADS1220_ConvertionProcess(FPGA2, F2_ANALOG_DYEINGH_TEMP3_1_TX_01, F2_ANALOG_DYEINGH_TEMP3_1_TX_00, 5);
+
+ rv = ADS1220_ConvertionProcess(FPGA2, F2_ANALOG_DYEINGH_TEMP4_1_TX_01, F2_ANALOG_DYEINGH_TEMP4_1_TX_00, 6);
+ rv = ADS1220_ConvertionProcess(FPGA2, F2_ANALOG_DYEINGH_TEMP5_1_TX_01, F2_ANALOG_DYEINGH_TEMP5_1_TX_00, 7);
+ rv = ADS1220_ConvertionProcess(FPGA2, F2_ANALOG_MIXCHIP_TEMP_1_TX_01, F2_ANALOG_MIXCHIP_TEMP_1_TX_00, 8);
+
+ rv = ADS1220_ConvertionProcess(FPGA2, F2_AN_ENCLOSURETEMP1_1_TX_01, F2_AN_ENCLOSURETEMP1_1_TX_00, 9);
+ rv = ADS1220_ConvertionProcess(FPGA2, F2_AN_ENCLOSURETEMP2_1_TX_01, F2_AN_ENCLOSURETEMP2_1_TX_00, 10);
+ rv = ADS1220_ConvertionProcess(FPGA2, F2_AN_ENCLOSURETEMP3_1_TX_01, F2_AN_ENCLOSURETEMP3_1_TX_00, 11);
+
+ stubManager.Write("\n");
+
+ k++;
+ if ( (k & 0x10) == 0x10 )
+ {
+ k = 0;
+ stubManager.Write("\nDRYER_TEMP1\tDRYER_TEMP2\tDRYER_TEMP3\tDYH_TEMP1\tDYH_TEMP2\tDYH_TEMP3\tDYH_TEMP4\tDYH_TEMP5\tMIX_TEMP\tENCTEMP1\tENCTEMP2\tENCTEMP3\n");
+ }
+
+ }
+
+
+}
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Other/I2C_DAC_MultiBytes.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Other/I2C_DAC_MultiBytes.cs
new file mode 100644
index 000000000..009f5450c
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/Other/I2C_DAC_MultiBytes.cs
@@ -0,0 +1,64 @@
+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;
+
+//----------------------
+//I2C4:
+// Switches address: 0xE0, 0xE4, 0xE3
+//I2C3
+// Switches address: 0xE0, 0xE4, 0xE3
+// ADC address: 0x40, 0x44, 0x46
+//I2C2
+// DAC address: 0x98
+// EEPROM address: 0xA0
+
+//----------------------
+const Int32 I2C_ID = 2;
+const Int32 I2C_Slave_Add = 0x98;
+//----------------------
+
+public void OnExecute(StubManager stubManager)
+{
+
+ // --------------------- I2C write multibyte ---------------------
+ StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest();
+ stubI2CWriteBytesRequest.I2CId = I2C_ID;
+ stubI2CWriteBytesRequest.SlaveAddress = I2C_Slave_Add;
+
+ UInt32 uInt32 = new UInt32();
+ stubI2CWriteBytesRequest.BytesTWrite.Add(0x30);//Byte 0 to write
+ stubI2CWriteBytesRequest.BytesTWrite.Add(0xff);//Byte 1 to Write
+ stubI2CWriteBytesRequest.BytesTWrite.Add(0x00);//Byte 2 to Write
+
+
+ //and so on,add lines in order to add Bytes - max : 256
+
+ var response = stubManager.Run<StubI2CWriteBytesResponse>(stubI2CWriteBytesRequest);
+
+/*
+ // --------------------- I2C Read multibyte ---------------------
+
+ StubI2CReadBytesRequest stubI2CReadBytesRequest = new StubI2CReadBytesRequest();
+ stubI2CReadBytesRequest.I2CId = I2C_ID;
+ stubI2CReadBytesRequest.SlaveAddress = I2C_Slave_Add;
+ stubI2CReadBytesRequest.NumberOfBytesToRead = 3; // Number of bytes to read
+
+ var response1 = stubManager.Run<StubI2CReadBytesResponse>(stubI2CReadBytesRequest);
+
+ for(int i=0; i<stubI2CReadBytesRequest.NumberOfBytesToRead;i++)
+ {
+ stubManager.WriteLineHex(response1.ReadBytes[i],2);
+ }
+
+*/
+
+
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Other/PT100__Horizontal_Printing.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Other/PT100__Horizontal_Printing.cs
new file mode 100644
index 000000000..5eefde9e8
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/Other/PT100__Horizontal_Printing.cs
@@ -0,0 +1,58 @@
+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.UI;
+using Tango.Stubs;//
+using Tango.PMR.Printing;
+using Tango.PMR.Hardware;
+
+
+public void OnExecute(StubManager stubManager)
+{
+ProcessParameters processParameters = new ProcessParameters();
+processParameters.DyeingSpeed = 30;
+processParameters.DryerBufferLength = 0;
+processParameters.MinInkUptake = 0;
+processParameters.DryerZone1Temp = 120;
+processParameters.DryerZone2Temp = 0;
+processParameters.DryerZone3Temp = 0;
+processParameters.HeadZone1Temp = 120;
+processParameters.HeadZone2Temp = 150;
+processParameters.HeadZone3Temp = 150;
+processParameters.HeadZone4Temp = 150;
+processParameters.HeadZone5Temp = 0;
+
+UploadProcessParametersRequest uploadProcessParametersRequest = new UploadProcessParametersRequest();
+
+uploadProcessParametersRequest.ProcessParameters = processParameters;
+var response1 = stubManager.Run<UploadProcessParametersResponse>(uploadProcessParametersRequest);
+
+
+ stubManager.Write("\n");
+ stubManager.Write("MIXCHIP \tDYEINGH_1\tDYEINGH_2\tDYEINGH_3\tDYEINGH_4\tDYEINGH_5\tDRYER_1 \tDRYER_2 \tDRYER_3 \tENCLOSURE_1\tENCLOSURE_2\tENCLOSURE_3\n");
+ stubManager.Write("------- \t---------\t---------\t---------\t---------\t---------\t------- \t------- \t------- \t-----------\t-----------\t-----------\n");
+
+ for (int j = 0; j < 1000; j++)
+ {
+ for (int i = 0; i < 12; i++)//12
+ {
+
+ var response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,i); //
+ float ftemp = (float)response.TemperatureCMultBy100;
+ ftemp = ftemp / 100;
+
+ stubManager.Write(ftemp.ToString("F2"));
+ stubManager.Write("°C \t");
+
+ }
+ stubManager.Write("\n");
+ Thread.Sleep(1000);
+ }
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Other/Tiva_Analogs.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Other/Tiva_Analogs.cs
new file mode 100644
index 000000000..c6d5ea2c7
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/Other/Tiva_Analogs.cs
@@ -0,0 +1,34 @@
+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 "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\Software\Stub_scripts\Tango_Defines_Basic.cs"
+
+
+/*
+
+Name Input channel Input parameter in the stub
+CHAN_AIR_PRESSURE_1 ADC_CTL_CH0 0
+CHAN_AIR_PRESSURE_2 ADC_CTL_CH1 1
+CHAN_VOCSENS ADC_CTL_CH10 10
+*/
+
+public void OnExecute(StubManager stubManager)
+{
+
+ for (int i=0; i<22; i++)
+ {
+ var response = stubManager.Run<StubIntADCReadResponse>("StubIntADCReadRequest" ,i);
+ stubManager.Write("\nADC VALUE, "); stubManager.Write(i); stubManager.Write("\t\t"); stubManager.WriteHex(response.SamplingInBits, 4); stubManager.Write("\t\t"); stubManager.Write(response.VoltageSamplingMv); stubManager.Write(" mV");
+ }
+
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Other/i2c_mcp9600.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Other/i2c_mcp9600.cs
new file mode 100644
index 000000000..5ee9ce4ee
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/Other/i2c_mcp9600.cs
@@ -0,0 +1,97 @@
+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 I2C_ID = 3; //MCU_I2C2
+const Int32 TCA9548A_address = 0xe2; //or 0xE0 or 0xE4
+const Int32 I2C_Slave_Add = 0xc0; // /MPC9600 address
+//const Int32 I2C_Slave_Add = 0x46; //must be 0x40, 0x44 or 0x46
+//----------------------
+
+int enable_all_channel()
+ {
+ StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest();
+ stubI2CWriteBytesRequest.I2CId = I2C_ID;
+ stubI2CWriteBytesRequest.SlaveAddress = TCA9548A_address;
+
+// UInt32 uInt32 = new UInt32();
+ stubI2CWriteBytesRequest.BytesTWrite.Add(0xff);//enable all 8 i2c channel
+
+ var response = stubManager.Run<StubI2CWriteBytesResponse>(stubI2CWriteBytesRequest);
+
+ return 1;
+ }
+
+
+
+
+int adc_set_for_read_ch(uint I2C_Slave_Add)
+ {
+ StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest();
+ stubI2CWriteBytesRequest.I2CId = I2C_ID;
+ stubI2CWriteBytesRequest.SlaveAddress = I2C_Slave_Add;
+
+ UInt32 uInt32 = new UInt32();
+ stubI2CWriteBytesRequest.BytesTWrite.Add(0x00);//Byte 0 to write
+
+ var response = stubManager.Run<StubI2CWriteBytesResponse>(stubI2CWriteBytesRequest);
+
+ return 1;
+ }
+
+
+int adc_read_ch(uint I2C_Slave_Add)
+ {
+ StubI2CReadBytesRequest stubI2CReadBytesRequest = new StubI2CReadBytesRequest();
+ stubI2CReadBytesRequest.I2CId = I2C_ID;
+ stubI2CReadBytesRequest.SlaveAddress = I2C_Slave_Add;
+ stubI2CReadBytesRequest.NumberOfBytesToRead = 2; // Number of bytes to read
+
+ var response1 = stubManager.Run<StubI2CReadBytesResponse>(stubI2CReadBytesRequest);
+ uint temph=0;
+ uint templ=0;
+ uint temp;
+ for(int i=0; i<stubI2CReadBytesRequest.NumberOfBytesToRead;i=i+2)
+ {
+ temph=response1.ReadBytes[i];
+ templ=response1.ReadBytes[i+1];
+ temp = (temph << 8) | templ;
+ temp=temp & 0x0fff;
+ stubManager.WriteHex(temp,4);
+
+ }
+
+ return 1;
+ }
+
+
+public void OnExecute(StubManager stubManager)
+{
+
+ enable_all_channel();
+
+ for (int i = 0; i<100; i++)
+ {
+
+
+// stubManager.Write("\n-----------te----------- ");
+
+ stubManager.Write("\n1= ");
+ adc_set_for_read_ch(I2C_Slave_Add);
+ adc_read_ch(I2C_Slave_Add);
+
+ Thread.Sleep(1000);
+
+ }
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/RTFU/RTFU_GPO.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/RTFU/RTFU_GPO.cs
new file mode 100644
index 000000000..966316f11
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/RTFU/RTFU_GPO.cs
@@ -0,0 +1,36 @@
+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 "Tango_Defines_GPO.cs"
+include "Tango_Defines_Motors.cs"
+//include "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\Software\Stub_scripts\Tango_Defines_Basic.cs"
+//include "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\Software\Stub_scripts\Interfaces\Tango_Defines_GPO.cs"
+//include "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\Software\Stub_scripts\Interfaces\Tango_Defines_Motors.cs"
+
+
+
+public void OnExecute(StubManager stubManager)
+{
+
+ Int32 i = 11; //Midtank Valve index //GPO_TFEED_BREAK_1 Mat10.7.2018
+
+ SetBit (FPGA1, F1_Moto_Driver_SW1, i, 1);
+ stubManager.Write("\n\nSetting GPO F1_Moto_Driver_SW1, bit "); stubManager.Write(i); stubManager.Write(", "); stubManager.Write(F1_Moto_Driver_SW1_Bits[i]);
+ Thread.Sleep(1000);
+ SetBit (FPGA1, F1_Moto_Driver_SW1, i, 0);
+ stubManager.Write("\nClearing GPO F1_Moto_Driver_SW1, bit "); stubManager.Write(i); stubManager.Write(", "); stubManager.Write(F1_Moto_Driver_SW1_Bits[i]);
+ Thread.Sleep(1000);
+
+
+}
+
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/RTFU/RTFU_LimitSwitch.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/RTFU/RTFU_LimitSwitch.cs
new file mode 100644
index 000000000..fa1566a8c
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/RTFU/RTFU_LimitSwitch.cs
@@ -0,0 +1,44 @@
+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 "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)
+{
+ uint Temp = 0;
+ int counter = 0;
+ stubManager.Write("\nReading register F1_LS_03_Direct: ");
+ var RetVal = Fpga_Read_Reg(FPGA1, F1_LS_03_Direct, 0);
+ stubManager.WriteHex(RetVal.Value,4);
+ Temp = RetVal.Value;
+ stubManager.Write("\nActivate limit switches one-by-one");
+
+ while ( counter != 100)
+ {
+ RetVal = Fpga_Read_Reg(FPGA1, F1_LS_03_Direct, 0);
+ if (RetVal.Value != Temp)
+ {
+ stubManager.Write("\nRegister F1_LS_03_Direct new value: ");
+ stubManager.WriteHex(RetVal.Value, 4);
+ counter = counter + 1;
+ }
+ Thread.Sleep(100);
+ Temp = RetVal.Value;
+
+ }
+
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/RTFU/RTFU_LimitSwitch1.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/RTFU/RTFU_LimitSwitch1.cs
new file mode 100644
index 000000000..ad3342d2a
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/RTFU/RTFU_LimitSwitch1.cs
@@ -0,0 +1,71 @@
+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 "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)
+{
+ uint Temp = 0;
+ uint Temp1 = 0;
+ int counter = 0;
+ stubManager.Write("\nReading register F1_LS_03_Direct: ");
+ var RetVal = Fpga_Read_Reg(FPGA1, F1_LS_03_Direct, 0);
+ stubManager.WriteHex(RetVal.Value,4);
+ Temp = RetVal.Value;
+ stubManager.Write("\nActivate limit switches one-by-one");
+
+ while ( counter != 100)
+ {
+ RetVal = Fpga_Read_Reg(FPGA1, F1_LS_03_Direct, 0);
+ if (RetVal.Value != Temp)
+ {
+ // stubManager.Write("\nRegister F1_LS_03_Direct new value: ");
+ // stubManager.WriteHex(RetVal.Value, 4);
+
+ // Temp1=RetVal.Value & 0x0010;
+ //if (Temp1 !=0x0010)
+ // stubManager.Write("\nRTFU LOADRAM Up");
+
+ Temp1=RetVal.Value & 0x0020;
+ if (Temp1 !=0x0020)
+ stubManager.Write("\nRTFU LOADRAM Down");
+
+ Temp1=RetVal.Value & 0x0040;
+ if (Temp1 !=0x0040)
+ stubManager.Write("\nRTFU LOADMOTOR Up");
+
+ Temp1=RetVal.Value & 0x0080;
+ if (Temp1 !=0x0080)
+ stubManager.Write("\nRTFU LOADMOTOR Down");
+
+ Temp1=RetVal.Value & 0x0100;
+ if (Temp1 !=0x0100)
+ stubManager.Write("\nRTFU DANCER Up");
+
+ Temp1=RetVal.Value & 0x0200;
+ if (Temp1 !=0x0200)
+ stubManager.Write("\nRTFU DANCER Down");
+
+
+ counter = counter + 1;
+ }
+ Thread.Sleep(100);
+ Temp = RetVal.Value;
+
+ }
+
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/RTFU/RTFU_Motors.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/RTFU/RTFU_Motors.cs
new file mode 100644
index 000000000..e2eaacabb
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/RTFU/RTFU_Motors.cs
@@ -0,0 +1,69 @@
+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 "Tango_Defines_Motors.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_Motors.cs"
+
+
+
+public void OnExecute(StubManager stubManager)
+{
+
+ stubManager.Write("\n\n*** RTFU Motor Test ***\n");
+
+ stubManager.Write("\n*** Pulling motor drivers out of reset\n");
+ SetBit(FPGA1, F1_Moto_Driver_NSTBYRST2, 2, 1);
+ SetBit(FPGA1, F1_Moto_Driver_NSTBYRST2, 4, 1);
+ SetBit(FPGA1, F1_Moto_Driver_NSTBYRST2, 5, 1);
+
+
+ //Place in high-Z state
+ stubManager.Write("\n*** Place in high-Z state\n");
+ Motor_HighZ(FPGA1, F1_MOTO_RLOADING_TX1, F1_MOTO_RLOADING_TX0);
+ Motor_HighZ(FPGA1, F1_MOTO_RDRIVING_TX1, F1_MOTO_RDRIVING_TX0);
+ Motor_HighZ(FPGA1, F1_MOTO_RDANCER_TX1, F1_MOTO_RDANCER_TX0);
+
+ //Motor_ReadCfg(FPGA1, F1_MOTO_RLOADING_TX1, F1_MOTO_RLOADING_TX0);
+ //Motor_ReadCfg(FPGA1, F1_MOTO_RDRIVING_TX1, F1_MOTO_RDRIVING_TX0);
+ //Motor_ReadCfg(FPGA1, F1_MOTO_RDANCER_TX1, F1_MOTO_RDANCER_TX0);
+
+ stubManager.Write("\n\n*** Moving motor F1_MOTO_RLOADING back and for 1 times...");
+ Motor_Move_Loop(FPGA1, F1_MOTO_RLOADING_TX1, F1_MOTO_RLOADING_TX0, 0x2400, 0x0, 1);
+ Thread.Sleep(1000);
+ Motor_Move_Loop(FPGA1, F1_MOTO_RLOADING_TX1, F1_MOTO_RLOADING_TX0, 0x6000, 0x1, 1);
+ Thread.Sleep(1000);
+ Motor_HighZ(FPGA1, F1_MOTO_RLOADING_TX1, F1_MOTO_RLOADING_TX0);
+ stubManager.Write("\n*** Stopped motor F1_MOTO_RLOADING");
+
+
+ stubManager.Write("\n*** Running motor F1_MOTO_RDRIVING for 4 seconds... ");
+ Motor_Run(FPGA1, F1_MOTO_RDRIVING_TX1, F1_MOTO_RDRIVING_TX0, 0xffff, 0x1);
+ Thread.Sleep(4000);
+ Motor_HighZ(FPGA1, F1_MOTO_RDRIVING_TX1, F1_MOTO_RDRIVING_TX0);
+ stubManager.Write("\n*** Stopped motor F1_MOTO_RDRIVING");
+
+ stubManager.Write("\n\n*** Moving motor F1_MOTO_RDANCER back and for for 1 times...");
+ Motor_Move_Loop(FPGA1, F1_MOTO_RDANCER_TX1, F1_MOTO_RDANCER_TX0, 0x200, 0x1, 1);
+ Thread.Sleep(1000);
+
+ Motor_Move_Loop(FPGA1, F1_MOTO_RDANCER_TX1, F1_MOTO_RDANCER_TX0, 0x200, 0x0, 1);
+ Motor_HighZ(FPGA1, F1_MOTO_RDANCER_TX1, F1_MOTO_RDANCER_TX0);
+ stubManager.Write("\n*** Stopped motor F1_MOTO_RDANCER");
+
+ stubManager.Write("\n\n*** RTFU Motor Test Ended ***");
+
+
+
+}
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/RTFU/RTFU_Motors_Switch.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/RTFU/RTFU_Motors_Switch.cs
new file mode 100644
index 000000000..dfcebb6f4
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/RTFU/RTFU_Motors_Switch.cs
@@ -0,0 +1,71 @@
+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.Diagnostics;
+using Tango.PMR.Stubs;
+using Tango.Stubs;
+
+
+include "..\..\Defines\Tango_Defines_Basic.cs"
+include "Tango_Defines_Motors.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_Motors.cs"
+
+
+
+public void OnExecute(StubManager stubManager)
+{
+
+ stubManager.Write("\n*** RTFU Motor + limit switch Test ***");
+ stubManager.Write("\n*** Pulling motor drivers out of reset\n");
+ SetBit(FPGA1, F1_Moto_Driver_NSTBYRST2, 2, 1);
+ SetBit(FPGA1, F1_Moto_Driver_NSTBYRST2, 4, 1);
+ SetBit(FPGA1, F1_Moto_Driver_NSTBYRST2, 5, 1);
+
+
+ //mov RLOAD - up
+ stubManager.Write("\n*** Moving motor F1_MOTO_RLOADING back and for 1 times...");
+ MotorHomingRequest motorHomingRequest = new MotorHomingRequest();
+ motorHomingRequest.MotorType = (Tango.PMR.Hardware.HardwareMotorType) 24;
+ motorHomingRequest.Speed = 500;
+ motorHomingRequest.Direction = Tango.PMR.Diagnostics.MotorDirection.Forward; //Forward
+ stubManager.Run(motorHomingRequest);
+ Thread.Sleep(5000);
+ //mov RLOAD - dn
+ motorHomingRequest.MotorType = (Tango.PMR.Hardware.HardwareMotorType) 24;
+ motorHomingRequest.Speed = 500;
+ motorHomingRequest.Direction = Tango.PMR.Diagnostics.MotorDirection.Backward; //Forward
+ stubManager.Run(motorHomingRequest);
+ Thread.Sleep(4000);
+ //mov RLOAD - to zero
+ var response = stubManager.Run<StubMotorMovResponse>("StubMotorMovRequest" ,24, true, 5000);
+ Thread.Sleep(4000);
+ //mov rdriving -
+ stubManager.Write("\n*** Running motor F1_MOTO_RDRIVING for 4 seconds... ");
+ Motor_Run(FPGA1, F1_MOTO_RDRIVING_TX1, F1_MOTO_RDRIVING_TX0, 0xffff, 0x1);
+ Thread.Sleep(4000);
+ Motor_HighZ(FPGA1, F1_MOTO_RDRIVING_TX1, F1_MOTO_RDRIVING_TX0);
+
+ stubManager.Write("\n*** F1_MOTO_RDANCER is moving back and forth ");
+ motorHomingRequest.MotorType = (Tango.PMR.Hardware.HardwareMotorType) 21;
+ motorHomingRequest.Speed = 10;
+ motorHomingRequest.Direction = Tango.PMR.Diagnostics.MotorDirection.Forward; //Forward
+ stubManager.Run(motorHomingRequest);
+ Thread.Sleep(5000);
+ motorHomingRequest.MotorType = (Tango.PMR.Hardware.HardwareMotorType) 21;
+ motorHomingRequest.Speed = 10;
+ motorHomingRequest.Direction = Tango.PMR.Diagnostics.MotorDirection.Backward; //Backard
+ stubManager.Run(motorHomingRequest);
+ Thread.Sleep(4000);
+
+ stubManager.Write("\n\n*** RTFU Motor Test Ended ***");
+
+
+
+}
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/RTFU/RTFU_Motors_Switch1.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/RTFU/RTFU_Motors_Switch1.cs
new file mode 100644
index 000000000..9a8c4eba6
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/RTFU/RTFU_Motors_Switch1.cs
@@ -0,0 +1,174 @@
+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.Diagnostics;
+using Tango.PMR.Stubs;
+using Tango.Stubs;
+
+
+include "..\..\Defines\Tango_Defines_Basic.cs"
+include "Tango_Defines_Motors.cs"
+include "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_Motors.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;
+ stubManager.Write("\n*** RTFU Motor + limit switch Test ***");
+// stubManager.Write("\n*** Pulling motor drivers out of reset\n");
+ SetBit(FPGA1, F1_Moto_Driver_NSTBYRST2, 2, 1);
+ SetBit(FPGA1, F1_Moto_Driver_NSTBYRST2, 4, 1);
+ SetBit(FPGA1, F1_Moto_Driver_NSTBYRST2, 5, 1);
+ Thread.Sleep(4000);
+
+ stubManager.Write("\nReading register F1_LS_03_Direct: ");
+ var RetVal = Fpga_Read_Reg(FPGA1, F1_LS_03_Direct, 0);
+ stubManager.WriteHex(RetVal.Value,4);
+
+var response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,21, true, 10);
+ while (Bit != 0x0) //wait until RTFU LOADRAM Down
+ {
+ Bit = GetBit(FPGA1, F1_LS_03_Direct,5);
+ Thread.Sleep(10);
+ }
+ Thread.Sleep(100);
+ stubManager.Write("\n--------1-LOADRAM--------");
+
+
+response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,21, false, 10);
+ Bit = 1;
+ while (Bit != 0x0) //wait until RTFU LOADRAM Down
+ {
+ Bit = GetBit(FPGA1, F1_LS_03_Direct,9);
+ Thread.Sleep(10);
+ }
+ Thread.Sleep(100);
+ stubManager.Write("\n--------2-LOADRAM-------");
+
+
+response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,21, true,10);
+ Bit = 1;
+ while (Bit != 0x0) //wait until RTFU LOADRAM Down
+ {
+ Bit = GetBit(FPGA1, F1_LS_03_Direct,8);
+ Thread.Sleep(10);
+ }
+ Thread.Sleep(100);
+ stubManager.Write("\n--------3-LOADRAM-------");
+
+ Motor_HighZ(FPGA1, F1_MOTO_RDANCER_TX1, F1_MOTO_RDANCER_TX0);
+
+//response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,21, false, 0);
+
+
+ Bit = 1;
+
+ response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,24, false, 500);
+ while (Bit != 0x0) //wait until RTFU LOADRAM Down
+ {
+ Bit = GetBit(FPGA1, F1_LS_03_Direct,6);
+ Thread.Sleep(10);
+ }
+ Thread.Sleep(100);
+ stubManager.Write("\n--------1--------");
+
+
+response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,24, true, 500);
+ Bit = 1;
+ while (Bit != 0x0) //wait until RTFU LOADRAM Down
+ {
+ Bit = GetBit(FPGA1, F1_LS_03_Direct,7);
+ Thread.Sleep(10);
+ }
+ stubManager.Write("\n--------2--------");
+ response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,24, true, 0);
+
+ Thread.Sleep(100);
+ var response1 = stubManager.Run<StubMotorMovResponse>("StubMotorMovRequest" ,24, true, 5000);
+ Thread.Sleep(1000);
+ Motor_HighZ(FPGA1, F1_MOTO_RLOADING_TX1, F1_MOTO_RLOADING_TX0);
+
+
+ //mov rdriving -
+ stubManager.Write("\n*** Running motor F1_MOTO_RDRIVING for 4 seconds... ");
+ Motor_Run(FPGA1, F1_MOTO_RDRIVING_TX1, F1_MOTO_RDRIVING_TX0, 0xffff, 0x1);
+ Thread.Sleep(4000);
+ Motor_HighZ(FPGA1, F1_MOTO_RDRIVING_TX1, F1_MOTO_RDRIVING_TX0);
+
+
+
+
+
+/*
+
+ stubManager.Write("\n*** F1_MOTO_RDANCER is moving back and forth ");
+ motorHomingRequest.MotorType = (Tango.PMR.Hardware.HardwareMotorType) 21;
+ motorHomingRequest.Speed = 10;
+ motorHomingRequest.Direction = Tango.PMR.Diagnostics.MotorDirection.Forward; //Forward
+ stubManager.Run(motorHomingRequest);
+ Thread.Sleep(5000);
+ motorHomingRequest.MotorType = (Tango.PMR.Hardware.HardwareMotorType) 21;
+ motorHomingRequest.Speed = 10;
+ motorHomingRequest.Direction = Tango.PMR.Diagnostics.MotorDirection.Backward; //Backard
+ stubManager.Run(motorHomingRequest);
+ Thread.Sleep(4000);
+
+*/
+
+
+
+
+
+/*
+
+ //mov RLOAD - up
+ stubManager.Write("\n*** Moving motor F1_MOTO_RLOADING back and for 1 times...");
+ MotorHomingRequest motorHomingRequest = new MotorHomingRequest();
+ motorHomingRequest.MotorType = (Tango.PMR.Hardware.HardwareMotorType) 24;
+ motorHomingRequest.Speed = 500;
+ motorHomingRequest.Direction = Tango.PMR.Diagnostics.MotorDirection.Forward; //Forward
+ stubManager.Run(motorHomingRequest);
+ Thread.Sleep(5000);
+ //mov RLOAD - dn
+ motorHomingRequest.MotorType = (Tango.PMR.Hardware.HardwareMotorType) 24;
+ motorHomingRequest.Speed = 500;
+ motorHomingRequest.Direction = Tango.PMR.Diagnostics.MotorDirection.Backward; //Forward
+ stubManager.Run(motorHomingRequest);
+ Thread.Sleep(4000);
+ //mov RLOAD - to zero
+ var response = stubManager.Run<StubMotorMovResponse>("StubMotorMovRequest" ,24, true, 5000);
+ Thread.Sleep(4000);
+*/
+
+
+
+
+ //mov rdriving -
+// stubManager.Write("\n*** Running motor F1_MOTO_RDRIVING for 4 seconds... ");
+// Motor_Run(FPGA1, F1_MOTO_RDRIVING_TX1, F1_MOTO_RDRIVING_TX0, 0xffff, 0x1);
+// Thread.Sleep(4000);
+// Motor_HighZ(FPGA1, F1_MOTO_RDRIVING_TX1, F1_MOTO_RDRIVING_TX0);
+
+
+
+ stubManager.Write("\n\n*** RTFU Motor Test Ended ***");
+
+
+
+}
+
+
+
+
+
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/RTFU/RTFU_SSI.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/RTFU/RTFU_SSI.cs
new file mode 100644
index 000000000..c62140767
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/RTFU/RTFU_SSI.cs
@@ -0,0 +1,49 @@
+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 "Tango_Defines_SSI.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_SSI.cs"
+
+public void OnExecute(StubManager stubManager)
+{
+
+ int k = 0;
+
+ Fpga_Read_Reg(FPGA1, F1_Prescaler1_reg1,0 );
+ Fpga_Read_Reg(FPGA1, F1_Prescaler1_reg2,0 );
+
+ //Set output clock frequency to about 200 kHz
+ Fpga_Write_Reg(FPGA1, F1_Prescaler1_reg1, 0x0024, 0);
+ Fpga_Write_Reg(FPGA1, F1_Prescaler1_reg2, 0x0024, 0);
+
+ Fpga_Read_Reg(FPGA1, F1_Prescaler1_reg1, 0);
+ Fpga_Read_Reg(FPGA1, F1_Prescaler1_reg2, 0);
+
+ for (int i = 0; i < 100; i++)
+ {
+
+
+ SSI_Read_Write(FPGA1, F1_RDANCER_ROTENC_MSB, F1_RDANCER_ROTENC_LSB, F1_RDANCER_ROTENC_TX);
+ SSI_Read_Write(FPGA1, F1_RSPARE_ROTENC_MSB, F1_RSPARE_ROTENC_LSB, F1_RSPARE_ROTENC_TX);
+ stubManager.Write("\n");
+ k++;
+ if ( (k & 0x8) == 0x08 ) {
+ k = 0;
+ stubManager.Write(" RDANCER RSpeed \n");
+ }
+ Thread.Sleep(400);
+ }
+
+
+}
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Winder_LimitSwitch.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Winder_LimitSwitch.cs
new file mode 100644
index 000000000..78aed1afc
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Winder_LimitSwitch.cs
@@ -0,0 +1,44 @@
+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 "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)
+{
+
+ uint Temp = 0;
+ int counter = 0;
+ stubManager.Write("\nReading register F1_LS_03_Direct: ");
+ var RetVal = Fpga_Read_Reg(FPGA1, F1_LS_03_Direct, 0);
+ stubManager.WriteHex(RetVal.Value,4);
+ Temp = RetVal.Value;
+ stubManager.Write("\nActivate limit switches one-by-one");
+
+ while ( counter != 100)
+ {
+ RetVal = Fpga_Read_Reg(FPGA1, F1_LS_03_Direct, 0);
+ if (RetVal.Value != Temp)
+ {
+ stubManager.Write("\nRegister F1_LS_03_Direct new value: ");
+ stubManager.WriteHex(RetVal.Value,4);
+ counter = counter + 1;
+ }
+ Thread.Sleep(100);
+ Temp=RetVal.Value;
+ }
+
+
+
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Winder_Motors.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Winder_Motors.cs
new file mode 100644
index 000000000..27c1a7d0d
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Winder_Motors.cs
@@ -0,0 +1,130 @@
+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 "Tango_Defines_Motors.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_Motors.cs"
+
+
+
+int Winder_Motor_CFG(Int32 Fpga, Int32 HighAdr, Int32 LowAdr)
+{
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x05, 0x00400000); //Acceleration
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x06, 0x00400000); //Deceleration
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x07, 0x00ff0000); //Maximum speed
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x08, 0x00000000); //Minimum speed and low speed optimization
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x09, 0x01000000); //Holding Kval
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x0a, 0x20000000); //Constant speed Kval
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x0b, 0x20000000); //Acceleration starting Kval
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x0c, 0x20000000); //Deceleration starting Kval
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x0d, 0x22c50000); //BEMF comp. curve intersect speed
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x0e, 0x07000000); //BEMF comp. curve starting slope
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x0f, 0x15000000); //BEMF comp. curve final slope (acceleration)
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x10, 0x15000000); //BEMF comp. curve final slope (deceleration)
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x11, 0x00000000); //Thermal compensation factor
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x13, 0xf0000000); //OCD threshold - Needs to be optimized. For now set to maximum
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x14, 0x7f000000); //STALL threshold - Needs to be optimized. For now set to maximum
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x15, 0x00ff0000); //Full step speed
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x16, 0x04000000); //Step mode and sync signal setup: Step mode: 1/16 step, Sync signal: Disabled
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x17, 0xff000000); //Alarms enables
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x18, 0x1ca00000); //IC configuration: Int. osc @16MHz (no clock output),
+ //SW input: HardStop interrupt, Motor supply voltage compensation: Enabled,
+ //Overcurrent shutdown: Enabled, Output slew-rate: Fastest, fPWM = fosc x 2 / 512
+ return 1;
+}
+
+int Screw_Motor_CFG(Int32 Fpga, Int32 HighAdr, Int32 LowAdr)
+{
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x05, 0x07ff0000); //Acceleration
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x06, 0x0fff0000); //Deceleration
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x07, 0x03ff0000); //Maximum speed - used for testing screw arm max speed
+ //Motor_SetParam( Fpga, HighAdr, LowAdr, 0x07, 0x000f0000); //Maximum speed - used for testing screw arm movent at low speed -> max. current
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x08, 0x00000000); //Minimum speed and low speed optimization
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x09, 0x01000000); //Holding Kval
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x0a, 0x20000000); //Constant speed Kval
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x0b, 0x20000000); //Acceleration starting Kval
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x0c, 0x20000000); //Deceleration starting Kval
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x0d, 0x22c50000); //BEMF comp. curve intersect speed
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x0e, 0x07000000); //BEMF comp. curve starting slope
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x0f, 0x15000000); //BEMF comp. curve final slope (acceleration)
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x10, 0x15000000); //BEMF comp. curve final slope (deceleration)
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x11, 0x00000000); //Thermal compensation factor
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x13, 0x0f000000); //OCD threshold
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x14, 0x7f000000); //STALL threshold - Needs to be optimized. For now set to maximum
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x15, 0x03ff0000); //Full step speed - Needs to be optimized. For now set to maximum
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x16, 0x05000000); //Step mode and sync signal setup: Step mode: 1/32 step, Sync signal: Disabled
+// Motor_SetParam( Fpga, HighAdr, LowAdr, 0x17, 0xff000000); //Alarms enables. Commented out since register can only be written during "stop". Trying to write during "High-Z" caused busy-bit to be stuck low
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x18, 0x1ca00000); //IC configuration: Int. osc @16MHz (no clock output),
+ //SW input: HardStop interrupt, Motor supply voltage compensation: Enabled,
+ //Overcurrent shutdown: Enabled, Output slew-rate: Fastest, fPWM = fosc x 2 / 512
+ return 1;
+}
+
+
+int Winder_Motor_Go(Int32 Fpga, Int32 HighAdr, Int32 LowAdr)
+ {
+ Motor_Run(Fpga, HighAdr, LowAdr, 0x016f00, 0x1); // 7 rps, 1400 full steps/second
+ //Motor_Run(Fpga, HighAdr, LowAdr, 0x02de00, 0x1); //14 rps, 2800 full steps/second
+ //Motor_Run(Fpga, HighAdr, LowAdr, 0x0395, 0x1); //17.5 rps, 3500 full steps/second
+ //Motor_HighZ(Fpga, HighAdr, LowAdr);
+ return 1;
+ }
+ int Winder_Motor_Go_Ccr(Int32 Fpga, Int32 HighAdr, Int32 LowAdr)
+ {
+ Motor_Run(Fpga, HighAdr, LowAdr, 0x016f00, 0x0); // 7 rps, 1400 full steps/second
+ //Motor_Run(Fpga, HighAdr, LowAdr, 0x02de00, 0x1); //14 rps, 2800 full steps/second
+ //Motor_Run(Fpga, HighAdr, LowAdr, 0x0395, 0x1); //17.5 rps, 3500 full steps/second
+ //Motor_HighZ(Fpga, HighAdr, LowAdr);
+ return 1;
+ }
+
+
+int Screw_Motor_Go(Int32 Fpga, Int32 HighAdr, Int32 LowAdr)
+ {
+ Motor_Move_Loop_Screw(Fpga, HighAdr, LowAdr, 0x4200, 0x1, 4); //0x4200 x 2 1/32 steps, 100 times back and forth
+ Motor_HighZ(Fpga, HighAdr, LowAdr);
+ return 1;
+ }
+
+
+public void OnExecute(StubManager stubManager)
+{
+
+ Int32 Bit = 0 ;
+ Motor_OutOfReset();
+ Thread.Sleep(50);
+ Motor_DriverReset();
+ Thread.Sleep(50);
+ Motor_OutOfReset();
+
+// Motor_HighZ(FPGA1, F1_MOTO_SCREW_A1_TX_01, F1_MOTO_SCREW_A1_TX_00);
+ Motor_HighZ(FPGA1, F1_MOTO_WINDER_A1_TX_01, F1_MOTO_WINDER_A1_TX_00);
+
+ //Configure motor drivers
+ Winder_Motor_CFG(FPGA1, F1_MOTO_WINDER_A1_TX_01, F1_MOTO_WINDER_A1_TX_00);
+// Screw_Motor_CFG(FPGA1, F1_MOTO_SCREW_A1_TX_01, F1_MOTO_SCREW_A1_TX_00);
+
+ //Run/move motors
+ Winder_Motor_Go(FPGA1, F1_MOTO_WINDER_A1_TX_01, F1_MOTO_WINDER_A1_TX_00);
+// Screw_Motor_Go(FPGA1, F1_MOTO_SCREW_A1_TX_01, F1_MOTO_SCREW_A1_TX_00);
+ Thread.Sleep(1000);
+
+// Motor_HighZ(FPGA1, F1_MOTO_SCREW_A1_TX_01, F1_MOTO_SCREW_A1_TX_00);
+ Motor_HighZ(FPGA1, F1_MOTO_WINDER_A1_TX_01, F1_MOTO_WINDER_A1_TX_00);
+ Thread.Sleep(1000);
+ Winder_Motor_Go_Ccr(FPGA1, F1_MOTO_WINDER_A1_TX_01, F1_MOTO_WINDER_A1_TX_00);
+
+ Thread.Sleep(1000);
+ Motor_HighZ(FPGA1, F1_MOTO_WINDER_A1_TX_01, F1_MOTO_WINDER_A1_TX_00);
+
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Winder_Screw_Motors.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Winder_Screw_Motors.cs
new file mode 100644
index 000000000..b5425e70b
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Winder_Screw_Motors.cs
@@ -0,0 +1,76 @@
+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 "Tango_Defines_Motors.cs"
+//include "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\Software\Stub_scripts\Tango_Defines_Basic.cs"
+//include "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\Software\Stub_scripts\Interfaces\Tango_Defines_Motors.cs"
+
+const Int32 F1_SCREW_ROTENC_lsb = 0x100 ; // Value of the lsb of the QEI register
+const Int32 F1_SCREW_ROTENC_msb = 0x102 ; // 10bits Value of the Msb of the QEI register, 1bit Direction of movement, 5bits Reserved
+const Int32 F1_SCREW_ROTENC_index = 0x104 ; // value of index counter
+
+
+
+int Motor_Params(Int32 Fpga, Int32 HighAdr, Int32 LowAdr)
+{
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x0a, 0x01000000); //Set KVAL_RUN to 0x01
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x0b, 0x04000000); //Set KVAL_ACC to 0x04
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x05, 0x00200000); //Set Acceleration to 0x002
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x13, 0x0f000000); //Set over current detect to 6 A
+ Motor_SetParam( Fpga, HighAdr, LowAdr, 0x18, 0x2d080000); //Disable shutdown by over current detect and set slew rate to 75 us
+ return 1;
+}
+
+
+
+public void OnExecute(StubManager stubManager)
+{
+
+
+ stubManager.Write("\n\n*** Winder Motor Test ***\n");
+
+ stubManager.Write("\n*** Pulling motor drivers out of reset\n");
+// SetBit(FPGA1, F1_Moto_Driver_NSTBYRST2, 0, 1); //winder
+ SetBit(FPGA1, F1_Moto_Driver_NSTBYRST2, 1, 1); //screw
+
+
+ //Place in high-Z state
+ stubManager.Write("\n*** Place in high-Z state\n");
+ Motor_HighZ(FPGA1, F1_MOTO_SCREW_A1_TX_01, F1_MOTO_SCREW_A1_TX_00);
+ Motor_HighZ(FPGA1, F1_MOTO_WINDER_A1_TX_01, F1_MOTO_WINDER_A1_TX_00);
+
+ /*
+ Motor_ReadCfg(FPGA1, F1_MOTO_SCREW_A1_TX_01, F1_MOTO_SCREW_A1_TX_00);
+ Motor_ReadCfg(FPGA1, F1_MOTO_WINDER_A1_TX_01, F1_MOTO_WINDER_A1_TX_00);
+ */
+
+ //stubManager.Write("\n*** Running motor F1_MOTO_SCREW for 8 seconds... ");
+ stubManager.Write("\n\n*** Moving motor F1_MOTO_SCREW back and for for 4 times...");
+ //Motor_Params( FPGA1, F1_MOTO_SCREW_A1_TX_01, F1_MOTO_SCREW_A1_TX_00); //Set KVAL_RUN to 0x01
+ //Motor_Run(FPGA1, F1_MOTO_SCREW_A1_TX_01, F1_MOTO_SCREW_A1_TX_00, 0xffff, 0x0);
+ Motor_Move_Loop(FPGA1, F1_MOTO_SCREW_A1_TX_01, F1_MOTO_SCREW_A1_TX_00, 0x6400, 0x1, 4);
+ //Thread.Sleep(1000);
+ Motor_HighZ(FPGA1, F1_MOTO_SCREW_A1_TX_01, F1_MOTO_SCREW_A1_TX_00);
+ stubManager.Write("\n*** Stopped motor F1_MOTO_SCREW");
+
+ stubManager.Write("\n*** Running motor F1_MOTO_WINDER for 8 seconds... ");
+ //Motor_Params( FPGA1, F1_MOTO_WINDER_A1_TX_01, F1_MOTO_WINDER_A1_TX_00); //Set KVAL_RUN to 0x01
+ Motor_Run(FPGA1, F1_MOTO_WINDER_A1_TX_01, F1_MOTO_WINDER_A1_TX_00, 0xffff, 0x1);
+ Thread.Sleep(8000);
+ Motor_HighZ(FPGA1, F1_MOTO_WINDER_A1_TX_01, F1_MOTO_WINDER_A1_TX_00);
+ stubManager.Write("\n*** Stopped motor F1_MOTO_WINDER");
+
+ stubManager.Write("\n\n*** RTFU Motor Test Ended ***");
+
+
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Winder_Screw_Motors1.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Winder_Screw_Motors1.cs
new file mode 100644
index 000000000..170072a28
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Winder_Screw_Motors1.cs
@@ -0,0 +1,91 @@
+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 "Tango_Defines_Motors.cs"
+include "Tango_Defines_LimitSwitch.cs"
+
+//include "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\Software\Stub_scripts\Tango_Defines_Basic.cs"
+//include "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\Software\Stub_scripts\Interfaces\Tango_Defines_Motors.cs"
+
+const Int32 F1_SCREW_ROTENC_lsb = 0x100 ; // Value of the lsb of the QEI register
+const Int32 F1_SCREW_ROTENC_msb = 0x102 ; // 10bits Value of the Msb of the QEI register, 1bit Direction of movement, 5bits Reserved
+const Int32 F1_SCREW_ROTENC_index = 0x104 ; // value of index counter
+
+
+
+int Motor_Params(Int32 Fpga, Int32 HighAdr, Int32 LowAdr)
+{
+// Motor_SetParam( Fpga, HighAdr, LowAdr, 0x0a, 0x01000000); //Set KVAL_RUN to 0x01
+// Motor_SetParam( Fpga, HighAdr, LowAdr, 0x0b, 0x04000000); //Set KVAL_ACC to 0x04
+// Motor_SetParam( Fpga, HighAdr, LowAdr, 0x05, 0x00200000); //Set Acceleration to 0x002
+// Motor_SetParam( Fpga, HighAdr, LowAdr, 0x13, 0x0f000000); //Set over current detect to 6 A
+// Motor_SetParam( Fpga, HighAdr, LowAdr, 0x18, 0x2d080000); //Disable shutdown by over current detect and set slew rate to 75 us
+ return 1;
+}
+
+
+
+public void OnExecute(StubManager stubManager)
+{
+ Int32 Bit=1;
+ Motor_HighZ(FPGA1, F1_MOTO_SCREW_A1_TX_01, F1_MOTO_SCREW_A1_TX_00);
+ Thread.Sleep(4000);
+
+ stubManager.Write("\n*** Moving motor F1_MOTO_screw back and for");
+
+ var response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,14,true , 1000);
+ while (Bit != 0x0) //wait until LTFU LOADRAM Down
+ {
+ Bit = GetBit(FPGA1, F1_LS_03_Direct,0);
+ Thread.Sleep(10);
+ }
+ Thread.Sleep(100);
+ stubManager.Write("\n--------1--------");
+
+
+response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,14, false, 1000);
+ Bit = 1;
+ while (Bit != 0x0) //wait until LTFU LOADRAM Down
+ {
+ Bit = GetBit(FPGA1, F1_LS_03_Direct,1);
+ Thread.Sleep(10);
+ }
+ stubManager.Write("\n--------2--------");
+
+ Thread.Sleep(100);
+ Motor_HighZ(FPGA1, F1_MOTO_SCREW_A1_TX_01, F1_MOTO_SCREW_A1_TX_00);
+
+ var response1 = stubManager.Run<StubMotorMovResponse>("StubMotorMovRequest" ,14, true, 250);
+ Thread.Sleep(1000);
+ stubManager.Write("\n*** Stopped motor F1_MOTO_SCREW");
+
+
+ Motor_HighZ(FPGA1, F1_MOTO_SCREW_A1_TX_01, F1_MOTO_SCREW_A1_TX_00);
+
+ stubManager.Write("\n*** Running motor F1_MOTO_WINDER for 8 seconds... ");
+ //Motor_Params( FPGA1, F1_MOTO_WINDER_A1_TX_01, F1_MOTO_WINDER_A1_TX_00); //Set KVAL_RUN to 0x01
+ Motor_Run(FPGA1, F1_MOTO_WINDER_A1_TX_01, F1_MOTO_WINDER_A1_TX_00, 0xffff, 0x1);
+ Thread.Sleep(5000);
+ Motor_HighZ(FPGA1, F1_MOTO_WINDER_A1_TX_01, F1_MOTO_WINDER_A1_TX_00);
+ stubManager.Write("\n*** Stopped motor F1_MOTO_WINDER");
+
+
+ }
+
+
+
+
+
+
+
+ \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_3WValve.cs b/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_3WValve.cs
new file mode 100644
index 000000000..ccbeea02a
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_3WValve.cs
@@ -0,0 +1,16 @@
+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;
+
+ //Reg Name Functionlity/Contents D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
+const Int32 F2_Prescaler1_reg12 = 0x122; // Variable for prescaler divisions parambit15 parambit14 parambit13 parambit12 parambit11 parambit10 parambit9 parambit8 parambit7 parambit6 parambit5 parambit4 parambit3 parambit2 parambit1 parambit0
+const Int32 F2_DISPENSER_VALVE_OUT = 0x0C2; // Writes to values. Readback the values that are currently in the GPO register F2_DISPENSER_VALVE_EN_8 F2_DISPENSER_VALVE_EN_7 F2_DISPENSER_VALVE_EN_6 F2_DISPENSER_VALVE_EN_5 F2_DISPENSER_VALVE_EN_4 F2_DISPENSER_VALVE_EN_3 F2_DISPENSER_VALVE_EN_2 F2_DISPENSER_VALVE_EN_1 F2_DISPENSER_VALVE_C1_8/F2_DISPENSER_VALVE_C2_8 F2_DISPENSER_VALVE_C1_7/F2_DISPENSER_VALVE_C2_7 F2_DISPENSER_VALVE_C1_6/F2_DISPENSER_VALVE_C2_6 F2_DISPENSER_VALVE_C1_5/F2_DISPENSER_VALVE_C2_5 F2_DISPENSER_VALVE_C1_4/F2_DISPENSER_VALVE_C2_4 F2_DISPENSER_VALVE_C1_3/F2_DISPENSER_VALVE_C2_3 F2_DISPENSER_VALVE_C1_2/F2_DISPENSER_VALVE_C2_2 F2_DISPENSER_VALVE_C1_1/F2_DISPENSER_VALVE_C2_1
+const Int32 F2_DISPENSER_VALVE_IN_Direct = 0x060; // Reads the direct values that are currently being sent to the fpga. Valve_busy_0 Valve_busy_1 Valve_busy_2 Valve_busy_3 Valve_busy_4 Valve_busy_5 Valve_busy_6 Valve_busy_7 F2_DISPENSER_VALVE_OCD_1 F2_DISPENSER_VALVE_OCD_2 F2_DISPENSER_VALVE_OCD_3 F2_DISPENSER_VALVE_OCD_4 F2_DISPENSER_VALVE_OCD_5 F2_DISPENSER_VALVE_OCD_6 F2_DISPENSER_VALVE_OCD_7 F2_DISPENSER_VALVE_OCD_8
diff --git a/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_Basic.cs b/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_Basic.cs
new file mode 100644
index 000000000..7dade8459
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_Basic.cs
@@ -0,0 +1,96 @@
+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;
+using Tango.Stubs;
+
+
+const Int32 FPGA1 = 0x60000000;
+const Int32 FPGA2 = 0x60000400;
+const Int32 FPGA3 = 0x60000800;
+
+
+const Int32 VER1_REG = 0x000;
+const Int32 VER2_REG = 0x010;
+const Int32 TEST_REG = 0x3f0;
+
+
+StubFpgaReadRegResponse Fpga_Read_Reg(Int32 Fpga, Int32 Addr, Int32 Verbose)
+{
+ var response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" , Fpga + Addr);
+ response.Value = response.Value & 0xffff;
+
+ if (Verbose == 1) {
+ stubManager.Write("FPGA Reg. Read (FPGA Base, Addr, Data): (");
+ stubManager.WriteHex(Fpga,4);
+ stubManager.Write(", ");
+ stubManager.WriteHex(Addr,4);
+ stubManager.Write(", ");
+ stubManager.WriteHex(response.Value,4);
+ stubManager.Write(")");
+ }
+
+ return response;
+}
+
+int Fpga_Write_Reg(Int32 Fpga, Int32 Addr, Int32 Data, Int32 Verbose)
+{
+ if (Verbose == 1) {
+ stubManager.Write("FPGA Reg. Write (FPGA Base, Addr, Data): (");
+ stubManager.WriteHex(Fpga,4);
+ stubManager.Write(", ");
+ stubManager.WriteHex(Addr,4);
+ stubManager.Write(", ");
+ stubManager.WriteHex(Data,4);
+ stubManager.Write(")");
+ }
+ var response = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,Fpga + Addr, Data);
+
+ return 1;
+}
+
+Int32 GetBit(Int32 Fpga, Int32 Adr, Int32 BitNo)
+{
+ Int32 BitMask;
+ var RetVal = Fpga_Read_Reg(Fpga, Adr, 0);
+ BitMask = 0x1 << BitNo;
+ if ( ( (Int32) RetVal.Value & BitMask) == BitMask )
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+
+}
+
+Int32 SetBit(Int32 Fpga, Int32 Adr, Int32 BitNo, Int32 Bit)
+{
+ Int32 BitMask;
+ var RetVal = Fpga_Read_Reg(Fpga, Adr, 0);
+ Int32 RV = (Int32) RetVal.Value;
+
+ if (Bit == 0x1)
+ {
+ BitMask = 0x1 << BitNo;
+ RV = RV | BitMask;
+ Fpga_Write_Reg(Fpga, Adr, RV , 0);
+ }
+ else if (Bit == 0x0)
+ {
+ BitMask = ~(0x1 << BitNo);
+ RV = RV & BitMask;
+ Fpga_Write_Reg(Fpga, Adr, RV , 0);
+ }
+ return 1;
+}
+
+
diff --git a/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_GPO.cs b/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_GPO.cs
new file mode 100644
index 000000000..8af98acbc
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_GPO.cs
@@ -0,0 +1,21 @@
+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 F3_VALVE_OUT = 0x0E2 ; // "F3_MIDTANK2MANIF4_VALVE_2", "F3_MIDTANK2MANIF4_VALVE_1", "F3_MIDTANK2MANIF3_VALVE_2", "F3_MIDTANK2MANIF3_VALVE_1", "F3_MIDTANK2MANIF2_VALVE_2", "F3_MIDTANK2MANIF2_VALVE_1", "F3_MIDTANK2MANIF1_VALVE_2", "F3_MIDTANK2MANIF1_VALVE_1", "F3_CART2MIDTANK4_VALVE_2", "F3_CART2MIDTANK4_VALVE_1", "F3_CART2MIDTANK3_VALVE_2", "F3_CART2MIDTANK3_VALVE_1", "F3_CART2MIDTANK2_VALVE_2", "F3_CART2MIDTANK2_VALVE_1", "F3_CART2MIDTANK1_VALVE_2", "F3_CART2MIDTANK1_VALVE_1"
+string[] F3_VALVE_Bits = {"F3_MIDTANK2MANIF4_VALVE_2", "F3_MIDTANK2MANIF4_VALVE_1", "F3_MIDTANK2MANIF3_VALVE_2", "F3_MIDTANK2MANIF3_VALVE_1", "F3_MIDTANK2MANIF2_VALVE_2", "F3_MIDTANK2MANIF2_VALVE_1", "F3_MIDTANK2MANIF1_VALVE_2", "F3_MIDTANK2MANIF1_VALVE_1", "F3_CART2MIDTANK4_VALVE_2", "F3_CART2MIDTANK4_VALVE_1", "F3_CART2MIDTANK3_VALVE_2", "F3_CART2MIDTANK3_VALVE_1", "F3_CART2MIDTANK2_VALVE_2", "F3_CART2MIDTANK2_VALVE_1", "F3_CART2MIDTANK1_VALVE_2", "F3_CART2MIDTANK1_VALVE_1"};
+
+const Int32 F1_gpo_01 = 0x3D2 ; // "F1_GPO_WASTECH_PUMP2", "F1_GPO_WHS_WTANKPUMP2", "F1_GPO_DILUTORPUMP_SSR10_CTRL ", "F1_GPO_EXTWINDER_3 ", "F1_GPO_EXTWINDER_2 ", "F1_GPO_EXTWINDER_1 ", "F1_VALVE_WASTE_TANK ", "F1_VALVE_MIXCHIP_WASTECH", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv"
+string[] F1_gpo_01_Bits = { "F1_GPO_WASTECH_PUMP2", "F1_GPO_WHS_WTANKPUMP2", "F1_GPO_DILUTORPUMP_SSR10_CTRL ", "F1_GPO_EXTWINDER_3 ", "F1_GPO_EXTWINDER_2 ", "F1_GPO_EXTWINDER_1 ", "F1_VALVE_WASTE_TANK ", "F1_VALVE_MIXCHIP_WASTECH", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv"};
+
+const Int32 F3_GPO_01_bus = 0x0C2 ; // "F3_GPO_LED4", "F3_GPO_LED3", "F3_GPO_LED2", "F3_GPO_LED1", "F3_GPO_EXTWINDER_SSR11_CTRL ", "F3_GPO_BUZZER", "F3_SPARE2_ROTENC_CLK", "F3_SPARE1_ROTENC_CLK", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv"
+string[] F3_GPO_01_bus_Bits = { "F3_GPO_LED4", "F3_GPO_LED3", "F3_GPO_LED2", "F3_GPO_LED1", "F3_GPO_EXTWINDER_SSR11_CTRL ", "F3_GPO_BUZZER", "F3_SPARE2_ROTENC_CLK", "F3_SPARE1_ROTENC_CLK", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv"};
diff --git a/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_LimitSwitch.cs b/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_LimitSwitch.cs
new file mode 100644
index 000000000..eff91f70a
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_LimitSwitch.cs
@@ -0,0 +1,39 @@
+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;
+
+
+
+//Reg Name Functionlity/Contents D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
+
+/*** LTFU and RTFU Limit switches ***/
+const Int32 F1_LS_01_Direct = 0x020 ; // Reads the direct values that are currently being sent to the fpga. rsv rsv F1_LS_DH_CLEAN_DOWN F1_LS_DH_CLEAN_LEFT F1_LS_DH_CLEAN_RIGHT F1_LS_DH_CLEAN_UP F1_LS_DH_LID_CLEANING F1_LS_DH_LID_CLOSED F1_LS_DH_LID_OPEN F1_LS_DH_SPARE2 F1_LS_DRYER_LID_CLOSED F1_LS_DRYER_LID_OPEN F1_LS_DRYER_SPARE1 F1_LS_DRYER_SPARE2 F1_LS_DRYER_SPARE3 F1_LS_DRYER_SPARE4
+const Int32 F1_LS_02_Direct = 0x030 ; // Reads the direct values that are currently being sent to the fpga. rsv rsv F1_LS_LDANCER1_DOWN F1_LS_LDANCER1_UP F1_LS_LDANCER2_DOWN F1_LS_LDANCER2_UP F1_LS_LLOADMOTOR_DOWN F1_LS_LLOADMOTOR_UP F1_LS_LOADARM_LEFT F1_LS_LOADARM_RIGHT F1_LS_LPIVOT_DOWN F1_LS_LPIVOT_UP F1_LS_LSPARE1 F1_LS_LSPARE2 F1_LS_PIVOT_SPARE1 F1_LS_PIVOT_SPARE2
+const Int32 F1_LS_03_Direct = 0x040 ; // Reads the direct values that are currently being sent to the fpga. rsv rsv rsv rsv F1_SW_SPOOL_EXISTS F1_SW_SPARE F1_LS_RDANCER_DOWN F1_LS_RDANCER_UP F1_LS_RLOADMOTOR_DOWN F1_LS_RLOADMOTOR_UP F1_LS_RLOADRAM_DOWN F1_LS_RLOADRAM_UP F1_LS_RSPARE1 F1_LS_RSPARE2 F1_LS_SCREW_LEFT F1_LS_SCREW_RIGHT
+
+/*** Dispenser switches ***/
+const Int32 F2_LS_01_Direct = 0x020 ; // Reads the direct values that are currently being sent to the fpga. rsv rsv rsv rsv F2_LS_DISPENSER_UP_2 F2_LS_DISPENSER_25_2 F2_LS_DISPENSER_75_2 F2_LS_DISPENSER_DOWN_2 F2_LS_DISPENSER_50_2 F2_LS_DISPENSER_SPARE_2 F2_LS_DISPENSER_UP_1 F2_LS_DISPENSER_25_1 F2_LS_DISPENSER_75_1 F2_LS_DISPENSER_DOWN_1 F2_LS_DISPENSER_50_1 F2_LS_DISPENSER_SPARE_1
+const Int32 F2_LS_02_Direct = 0x030 ; // Reads the direct values that are currently being sent to the fpga. rsv rsv rsv rsv F2_LS_DISPENSER_UP_4 F2_LS_DISPENSER_25_4 F2_LS_DISPENSER_75_4 F2_LS_DISPENSER_DOWN_4 F2_LS_DISPENSER_50_4 F2_LS_DISPENSER_SPARE_4 F2_LS_DISPENSER_UP_3 F2_LS_DISPENSER_25_3 F2_LS_DISPENSER_75_3 F2_LS_DISPENSER_DOWN_3 F2_LS_DISPENSER_50_3 F2_LS_DISPENSER_SPARE_3
+const Int32 F2_LS_03_Direct = 0x040 ; // Reads the direct values that are currently being sent to the fpga. rsv rsv rsv rsv F2_LS_DISPENSER_UP_6 F2_LS_DISPENSER_25_6 F2_LS_DISPENSER_75_6 F2_LS_DISPENSER_DOWN_6 F2_LS_DISPENSER_50_6 F2_LS_DISPENSER_SPARE_6 F2_LS_DISPENSER_UP_5 F2_LS_DISPENSER_25_5 F2_LS_DISPENSER_75_5 F2_LS_DISPENSER_DOWN_5 F2_LS_DISPENSER_50_5 F2_LS_DISPENSER_SPARE_5
+const Int32 F2_LS_04_Direct = 0x080 ; // Reads the direct values that are currently being sent to the fpga. rsv rsv rsv rsv F2_LS_DISPENSER_UP_8 F2_LS_DISPENSER_25_8 F2_LS_DISPENSER_75_8 F2_LS_DISPENSER_DOWN_8 F2_LS_DISPENSER_50_8 F2_LS_DISPENSER_SPARE_8 F2_LS_DISPENSER_UP_7 F2_LS_DISPENSER_25_7 F2_LS_DISPENSER_75_7 F2_LS_DISPENSER_DOWN_7 F2_LS_DISPENSER_50_7 F2_LS_DISPENSER_SPARE_7
+
+const Int32 F3_LS_01_Direct = 0x080 ; // Reads the direct values that are currently being sent to the fpga. rsv rsv rsv rsv rsv rsv rsv rsv F3_LS_SPARE1_1 F3_LS_SPARE1_2 F3_LS_SPARE1_3 F3_LS_SPARE1_4 F3_LS_SPARE2_1 F3_LS_SPARE2_2 F3_LS_SPARE2_3 F3_LS_SPARE2_4
+
+string[] F1_LS_01_Bits = { "F1_LS_DRYER_SPARE4", "F1_LS_DRYER_SPARE3", "F1_LS_DRYER_SPARE2", "F1_LS_DRYER_SPARE1", "F1_LS_DRYER_LID_OPEN", "F1_LS_DRYER_LID_CLOSED", "F1_LS_DH_SPARE2", "F1_LS_DH_LID_OPEN", "F1_LS_DH_LID_CLOSED", "F1_LS_DH_LID_CLEANING", "F1_LS_DH_CLEAN_UP", "F1_LS_DH_CLEAN_RIGHT", "F1_LS_DH_CLEAN_LEFT", "F1_LS_DH_CLEAN_DOWN", "rsv", "rsv"};
+string[] F1_LS_02_Bits = { "F1_LS_PIVOT_SPARE2", "F1_LS_PIVOT_SPARE1", "F1_LS_LSPARE2", "F1_LS_LSPARE1", "F1_LS_LPIVOT_UP", "F1_LS_LPIVOT_DOWN", "F1_LS_LOADARM_RIGHT", "F1_LS_LOADARM_LEFT", "F1_LS_LLOADMOTOR_UP", "F1_LS_LLOADMOTOR_DOWN", "F1_LS_LDANCER2_UP", "F1_LS_LDANCER2_DOWN", "F1_LS_LDANCER1_UP", "F1_LS_LDANCER1_DOWN", "rsv", "rsv"};
+string[] F1_LS_03_Bits = { "F1_LS_SCREW_RIGHT", "F1_LS_SCREW_LEFT", "F1_LS_RSPARE2", "F1_LS_RSPARE1", "F1_LS_RLOADRAM_UP", "F1_LS_RLOADRAM_DOWN", "F1_LS_RLOADMOTOR_UP", "F1_LS_RLOADMOTOR_DOWN", "F1_LS_RDANCER_UP", "F1_LS_RDANCER_DOWN", "F1_SW_SPARE", "F1_SW_SPOOL_EXISTS", "rsv", "rsv", "rsv", "rsv"};
+string[] F2_LS_01_Bits = { "F2_LS_DISPENSER_SPARE_1", "F2_LS_DISPENSER_50_1", "F2_LS_DISPENSER_DOWN_1", "F2_LS_DISPENSER_75_1", "F2_LS_DISPENSER_25_1", "F2_LS_DISPENSER_UP_1", "F2_LS_DISPENSER_SPARE_2", "F2_LS_DISPENSER_50_2", "F2_LS_DISPENSER_DOWN_2", "F2_LS_DISPENSER_75_2", "F2_LS_DISPENSER_25_2", "F2_LS_DISPENSER_UP_2", "rsv", "rsv", "rsv", "rsv"};
+string[] F2_LS_02_Bits = { "F2_LS_DISPENSER_SPARE_3", "F2_LS_DISPENSER_50_3", "F2_LS_DISPENSER_DOWN_3", "F2_LS_DISPENSER_75_3", "F2_LS_DISPENSER_25_3", "F2_LS_DISPENSER_UP_3", "F2_LS_DISPENSER_SPARE_4", "F2_LS_DISPENSER_50_4", "F2_LS_DISPENSER_DOWN_4", "F2_LS_DISPENSER_75_4", "F2_LS_DISPENSER_25_4", "F2_LS_DISPENSER_UP_4", "rsv", "rsv", "rsv", "rsv"};
+string[] F2_LS_03_Bits = { "F2_LS_DISPENSER_SPARE_5", "F2_LS_DISPENSER_50_5", "F2_LS_DISPENSER_DOWN_5", "F2_LS_DISPENSER_75_5", "F2_LS_DISPENSER_25_5", "F2_LS_DISPENSER_UP_5", "F2_LS_DISPENSER_SPARE_6", "F2_LS_DISPENSER_50_6", "F2_LS_DISPENSER_DOWN_6", "F2_LS_DISPENSER_75_6 ", "F2_LS_DISPENSER_25_6 ", "F2_LS_DISPENSER_UP_6 ", "rsv", "rsv", "rsv", "rsv"};
+string[] F2_LS_04_Bits = { "F2_LS_DISPENSER_SPARE_7", "F2_LS_DISPENSER_50_7", "F2_LS_DISPENSER_DOWN_7", "F2_LS_DISPENSER_75_7", "F2_LS_DISPENSER_25_7", "F2_LS_DISPENSER_UP_7", "F2_LS_DISPENSER_SPARE_8", "F2_LS_DISPENSER_50_8", "F2_LS_DISPENSER_DOWN_8", "F2_LS_DISPENSER_75_8", "F2_LS_DISPENSER_25_8", "F2_LS_DISPENSER_UP_8", "rsv", "rsv", "rsv", "rsv"};
+string[] F3_LS_01_Bits = { "F3_LS_SPARE2_4", "F3_LS_SPARE2_3", "F3_LS_SPARE2_2", "F3_LS_SPARE2_1", "F3_LS_SPARE1_4", "F3_LS_SPARE1_3", "F3_LS_SPARE1_2", "F3_LS_SPARE1_1", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv"};
+
+
diff --git a/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_Motors.cs b/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_Motors.cs
new file mode 100644
index 000000000..164d573c5
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_Motors.cs
@@ -0,0 +1,413 @@
+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;
+
+//Reg Name Functionlity/Contents D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
+const Int32 F1_Moto_Driver_NBUSY1_Direct = 0x050;// Reads the direct values that are currently being sent to the fpga. rsv rsv rsv rsv rsv F1_MOTO_DH_CLEANHEAD_A1_NBUSY F1_MOTO_DH_CLEANMECH_A1_NBUSY F1_MOTO_DH_LID_A1_NBUSY F1_MOTO_DRYER_DRIVING_A1_NBUSY F1_MOTO_DRYER_LID_A1_NBUSY F1_MOTO_DRYER_LOADARM_A1_NBUSY F1_MOTO_LDANCER1_A1_NBUSY F1_MOTO_LDANCER2_A1_NBUSY F1_MOTO_LDRIVING_A1_NBUSY F1_MOTO_LLOADING_A1_NBUSY F1_MOTO_LPIVOT1_A1_NBUSY
+const Int32 F1_Moto_Driver_NBUSY2_Direct = 0x060;// Reads the direct values that are currently being sent to the fpga. rsv rsv rsv rsv rsv rsv rsv rsv rsv rsv F1_MOTO_RDANCER_A1_NBUSY F1_MOTO_RDRIVING_A1_NBUSY F1_MOTO_RLOADARM_A1_NBUSY F1_MOTO_RLOADING_A1_NBUSY F1_MOTO_SCREW_A1_NBUSY F1_MOTO_WINDER_A1_NBUSY
+const Int32 F2_Moto_Driver_NBUSY1_Direct = 0x050;// Reads the direct values that are currently being sent to the fpga. rsv rsv rsv rsv rsv rsv rsv rsv F2_MOTO_DISPENSER_A1_1_NBUSY F2_MOTO_DISPENSER_A1_2_NBUSY F2_MOTO_DISPENSER_A1_3_NBUSY F2_MOTO_DISPENSER_A1_4_NBUSY F2_MOTO_DISPENSER_A1_5_NBUSY F2_MOTO_DISPENSER_A1_6_NBUSY F2_MOTO_DISPENSER_A1_7_NBUSY F2_MOTO_DISPENSER_A1_8_NBUSY
+const Int32 F3_Moto_Driver_NBUSY1_Direct = 0x060;// Reads the direct values that are currently being sent to the fpga. rsv rsv rsv rsv rsv rsv rsv rsv rsv rsv rsv F3_MOTO_SPARE3_1_A1_NBUSY F3_MOTO_SPARE2_2_A1_NBUSY F3_MOTO_SPARE2_1_A1_NBUSY F3_MOTO_SPARE1_2_A1_NBUSY F3_MOTO_SPARE1_1_A1_NBUSY
+
+/*** Motor Driver Reset Signals ***/
+//Reg Name Functionlity/Contents D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
+
+const Int32 F1_Moto_Driver_NSTBYRST1 = 0x0B2 ; // "F1_MOTO_LPIVOT1_A1_NSTBYRST", "F1_MOTO_LLOADING_A1_NSTBYRST", "F1_MOTO_LDRIVING_A1_NSTBYRST", "F1_MOTO_LDANCER2_A1_NSTBYRST", "F1_MOTO_LDANCER1_A1_NSTBYRST", "F1_MOTO_DRYER_LOADARM_A1_NSTBYRST", "F1_MOTO_DRYER_LID_A1_NSTBYRST", "F1_MOTO_DRYER_DRIVING_A1_NSTBYRST", "F1_MOTO_DH_LID_A1_NSTBYRST", "F1_MOTO_DH_CLEANMECH_A1_NSTBYRST", "F1_MOTO_DH_CLEANHEAD_A1_NSTBYRST", "rsv", "rsv", "rsv", "rsv", "rsv"
+string[] F1_Moto_Driver_NSTBYRST1_Bits = {"F1_MOTO_LPIVOT1_A1_NSTBYRST", "F1_MOTO_LLOADING_A1_NSTBYRST", "F1_MOTO_LDRIVING_A1_NSTBYRST", "F1_MOTO_LDANCER2_A1_NSTBYRST", "F1_MOTO_LDANCER1_A1_NSTBYRST", "F1_MOTO_DRYER_LOADARM_A1_NSTBYRST", "F1_MOTO_DRYER_LID_A1_NSTBYRST", "F1_MOTO_DRYER_DRIVING_A1_NSTBYRST", "F1_MOTO_DH_LID_A1_NSTBYRST", "F1_MOTO_DH_CLEANMECH_A1_NSTBYRST", "F1_MOTO_DH_CLEANHEAD_A1_NSTBYRST", "rsv", "rsv", "rsv", "rsv", "rsv"};
+
+const Int32 F1_Moto_Driver_NSTBYRST2 = 0x0C2 ; // "F1_MOTO_WINDER_A1_NSTBYRST", "F1_MOTO_SCREW_A1_NSTBYRST", "F1_MOTO_RLOADING_A1_NSTBYRST", "F1_MOTO_RLOADARM_A1_NSTBYRST", "F1_MOTO_RDRIVING_A1_NSTBYRST", "F1_MOTO_RDANCER_A1_NSTBYRST", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv"
+string[] F1_Moto_Driver_NSTBYRST2_Bits = {"F1_MOTO_WINDER_A1_NSTBYRST", "F1_MOTO_SCREW_A1_NSTBYRST", "F1_MOTO_RLOADING_A1_NSTBYRST", "F1_MOTO_RLOADARM_A1_NSTBYRST", "F1_MOTO_RDRIVING_A1_NSTBYRST", "F1_MOTO_RDANCER_A1_NSTBYRST", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv"};
+
+const Int32 F2_Moto_Driver_NSTBYRST1 = 0x0B2 ; // "F2_MOTO_DISPENSER_A1_8_NSTBYRST", "F2_MOTO_DISPENSER_A1_7_NSTBYRST", "F2_MOTO_DISPENSER_A1_6_NSTBYRST", "F2_MOTO_DISPENSER_A1_5_NSTBYRST", "F2_MOTO_DISPENSER_A1_4_NSTBYRST", "F2_MOTO_DISPENSER_A1_3_NSTBYRST", "F2_MOTO_DISPENSER_A1_2_NSTBYRST", "F2_MOTO_DISPENSER_A1_1_NSTBYRST", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv"
+string[] F2_Moto_Driver_NSTBYRST1_Bits = {"F2_MOTO_DISPENSER_A1_8_NSTBYRST", "F2_MOTO_DISPENSER_A1_7_NSTBYRST", "F2_MOTO_DISPENSER_A1_6_NSTBYRST", "F2_MOTO_DISPENSER_A1_5_NSTBYRST", "F2_MOTO_DISPENSER_A1_4_NSTBYRST", "F2_MOTO_DISPENSER_A1_3_NSTBYRST", "F2_MOTO_DISPENSER_A1_2_NSTBYRST", "F2_MOTO_DISPENSER_A1_1_NSTBYRST", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv"};
+
+const Int32 F3_Moto_Driver_NSTBYRST1 = 0x0B2 ; // "F3_MOTO_SPARE3_1_A1_NSTBYRST", "F3_MOTO_SPARE2_2_A1_NSTBYRST", "F3_MOTO_SPARE2_1_A1_NSTBYRST", "F3_MOTO_SPARE1_2_A1_NSTBYRST", "F3_MOTO_SPARE1_1_A1_NSTBYRST", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv"
+string[] F3_Moto_Driver_NSTBYRST1_Bits = {"F3_MOTO_SPARE3_1_A1_NSTBYRST", "F3_MOTO_SPARE2_2_A1_NSTBYRST", "F3_MOTO_SPARE2_1_A1_NSTBYRST", "F3_MOTO_SPARE1_2_A1_NSTBYRST", "F3_MOTO_SPARE1_1_A1_NSTBYRST", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv"};
+
+/*** SW signals ***/
+const Int32 F1_Moto_Driver_SW1 = 0x0D2 ; // "F1_MOTO_LPIVOT1_A1_SW ", "F1_MOTO_LLOADING_A1_SW ", "F1_MOTO_LDRIVING_A1_SW ", "F1_MOTO_LDANCER2_A1_SW ", "F1_MOTO_LDANCER1_A1_SW ", "F1_MOTO_DRYER_LOADARM_A1_SW ", "F1_MOTO_DRYER_LID_A1_SW ", "F1_MOTO_DRYER_DRIVING_A1_SW ", "F1_MOTO_DH_LID_A1_SW ", "F1_MOTO_DH_CLEANMECH_A1_SW ", "F1_MOTO_DH_CLEANHEAD_A1_SW", "F1_GPO_TFEED_BREAK_1", "F1_GPO_TFEED_BREAK_2", "rsv", "rsv", "rsv"
+string[] F1_Moto_Driver_SW1_Bits = {"F1_MOTO_LPIVOT1_A1_SW ", "F1_MOTO_LLOADING_A1_SW ", "F1_MOTO_LDRIVING_A1_SW ", "F1_MOTO_LDANCER2_A1_SW ", "F1_MOTO_LDANCER1_A1_SW ", "F1_MOTO_DRYER_LOADARM_A1_SW ", "F1_MOTO_DRYER_LID_A1_SW ", "F1_MOTO_DRYER_DRIVING_A1_SW ", "F1_MOTO_DH_LID_A1_SW ", "F1_MOTO_DH_CLEANMECH_A1_SW ", "F1_MOTO_DH_CLEANHEAD_A1_SW", "F1_GPO_TFEED_BREAK_1", "F1_GPO_TFEED_BREAK_2", "rsv", "rsv", "rsv"};
+const Int32 F1_Moto_Driver_SW2 = 0x0E2 ; // "F1_MOTO_WINDER_A1_SW", "F1_MOTO_SCREW_A1_SW ", "F1_MOTO_RLOADING_A1_SW ", "F1_MOTO_RLOADARM_A1_SW ", "F1_MOTO_RDRIVING_A1_SW ", "F1_MOTO_RDANCER_A1_SW ", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv"
+const Int32 F2_Moto_Driver_SW1 = 0x0D2 ; // "F1_MOTO_LPIVOT1_A1_SW ", "F1_MOTO_LLOADING_A1_SW ", "F1_MOTO_LDRIVING_A1_SW ", "F1_MOTO_LDANCER2_A1_SW ", "F1_MOTO_LDANCER1_A1_SW ", "F1_MOTO_DRYER_LOADARM_A1_SW ", "F1_MOTO_DRYER_LID_A1_SW ", "F1_MOTO_DRYER_DRIVING_A1_SW ", "F1_MOTO_DH_LID_A1_SW ", "F1_MOTO_DH_CLEANMECH_A1_SW ", "F1_MOTO_DH_CLEANHEAD_A1_SW", "F1_GPO_TFEED_BREAK_1", "F1_GPO_TFEED_BREAK_2", "rsv", "rsv", "rsv"
+const Int32 F3_Moto_Driver_SW1 = 0x0D2 ; // "F3_MOTO_SPARE1_1_A1_SW", "F3_MOTO_SPARE1_2_A1_SW", "F3_MOTO_SPARE2_1_A1_SW", "F3_MOTO_SPARE2_2_A1_SW", "F3_MOTO_SPARE3_1_A1_SW", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv", "rsv"
+
+
+/*** RTFU Motors ***/
+const Int32 F1_MOTO_RLOADING_TX1 = 0x0202;
+const Int32 F1_MOTO_RLOADING_TX0 = 0x0200;
+const Int32 F1_MOTO_RLOADING_RX1 = 0x0206;
+const Int32 F1_MOTO_RLOADING_RX0 = 0x0204;
+const Int32 F1_MOTO_RDRIVING_TX1 = 0x0212;
+const Int32 F1_MOTO_RDRIVING_TX0 = 0x0210;
+const Int32 F1_MOTO_RDRIVING_RX1 = 0x0216;
+const Int32 F1_MOTO_RDRIVING_RX0 = 0x0214;
+const Int32 F1_MOTO_RLOADARM_TX1 = 0x02a2;
+const Int32 F1_MOTO_RLOADARM_TX0 = 0x02a0;
+const Int32 F1_MOTO_RDANCER_TX1 = 0x02b2;
+const Int32 F1_MOTO_RDANCER_TX0 = 0x02b0;
+
+/*** LTFU Motors ***/
+const Int32 F1_MOTO_LDRIVING_TX1 = 0x0222;
+const Int32 F1_MOTO_LDRIVING_TX0 = 0x0220;
+const Int32 F1_MOTO_LDRIVING_RX1 = 0x0226;
+const Int32 F1_MOTO_LDRIVING_RX0 = 0x0224;
+const Int32 F1_MOTO_LLOADING_TX1 = 0x0232;
+const Int32 F1_MOTO_LLOADING_TX0 = 0x0230;
+const Int32 F1_MOTO_LDANCER1_TX1 = 0x02c2;
+const Int32 F1_MOTO_LDANCER1_TX0 = 0x02c0;
+const Int32 F1_MOTO_LDANCER2_TX1 = 0x02d2;
+const Int32 F1_MOTO_LDANCER2_TX0 = 0x02d0;
+const Int32 F1_MOTO_LDANCER2_A1_AMT_OF_WORDS = 0x02d8;
+const Int32 F1_MOTO_LPIVOT1_TX1 = 0x0302;
+const Int32 F1_MOTO_LPIVOT1_TX0 = 0x0300;
+const Int32 F1_MOTO_LPIVOT1_A1_AMT_OF_WORDS = 0x0308;
+
+/*** Dryer Motors ***/
+const Int32 F1_MOTO_DRYER_LOADARM_A1_TX_00 = 0x240 ;
+const Int32 F1_MOTO_DRYER_LOADARM_A1_TX_01 = 0x242 ;
+const Int32 F1_MOTO_DRYER_LOADARM_A1_RX_00 = 0x244 ;
+const Int32 F1_MOTO_DRYER_LOADARM_A1_RX_01 = 0x246 ;
+const Int32 F1_MOTO_DRYER_DRIVING_A1_TX_00 = 0x250 ;
+const Int32 F1_MOTO_DRYER_DRIVING_A1_TX_01 = 0x252 ;
+const Int32 F1_MOTO_DRYER_DRIVING_A1_RX_00 = 0x254 ;
+const Int32 F1_MOTO_DRYER_DRIVING_A1_RX_01 = 0x256 ;
+const Int32 F1_MOTO_DRYER_LID_A1_TX_00 = 0x2E0 ;
+const Int32 F1_MOTO_DRYER_LID_A1_TX_01 = 0x2E2 ;
+const Int32 F1_MOTO_DRYER_LID_A1_RX_00 = 0x2E4 ;
+const Int32 F1_MOTO_DRYER_LID_A1_RX_01 = 0x2E6 ;
+
+/*** Dyeing Head Motors ***/
+const Int32 F1_MOTO_DH_CLEANHEAD_A1_TX_00 = 0x260 ;
+const Int32 F1_MOTO_DH_CLEANHEAD_A1_TX_01 = 0x262 ;
+const Int32 F1_MOTO_DH_CLEANHEAD_A1_RX_00 = 0x264 ;
+const Int32 F1_MOTO_DH_CLEANHEAD_A1_RX_01 = 0x266 ;
+const Int32 F1_MOTO_DH_CLEANMECH_A1_TX_00 = 0x270 ;
+const Int32 F1_MOTO_DH_CLEANMECH_A1_TX_01 = 0x272 ;
+const Int32 F1_MOTO_DH_CLEANMECH_A1_RX_00 = 0x274 ;
+const Int32 F1_MOTO_DH_CLEANMECH_A1_RX_01 = 0x276 ;
+const Int32 F1_MOTO_DH_LID_A1_TX_00 = 0x2F0 ;
+const Int32 F1_MOTO_DH_LID_A1_TX_01 = 0x2F2 ;
+const Int32 F1_MOTO_DH_LID_A1_RX_00 = 0x2F4 ;
+const Int32 F1_MOTO_DH_LID_A1_RX_01 = 0x2F6 ;
+
+/*** Winder Motors ***/
+const Int32 F1_MOTO_SCREW_A1_TX_00 = 0x280 ;
+const Int32 F1_MOTO_SCREW_A1_TX_01 = 0x282 ;
+const Int32 F1_MOTO_SCREW_A1_RX_00 = 0x284 ;
+const Int32 F1_MOTO_SCREW_A1_RX_01 = 0x286 ;
+const Int32 F1_MOTO_WINDER_A1_TX_00 = 0x290 ;
+const Int32 F1_MOTO_WINDER_A1_TX_01 = 0x292 ;
+const Int32 F1_MOTO_WINDER_A1_RX_00 = 0x294 ;
+const Int32 F1_MOTO_WINDER_A1_RX_01 = 0x296 ;
+
+/*** Dispenser Motors ***/
+const Int32 F2_MOTO_DISPENSER_A1_1_TX_00 = 0x320 ; // The second register to be shifted out of the spi. The msb bit of this register is shifted out first.
+const Int32 F2_MOTO_DISPENSER_A1_1_TX_01 = 0x322 ; // The first register to be shifted out of the spi. The msb bit of this register is shifted out first.
+const Int32 F2_MOTO_DISPENSER_A1_1_RX_00 = 0x324 ; // The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros.
+const Int32 F2_MOTO_DISPENSER_A1_1_RX_01 = 0x326 ; // The 16 Lsb bits of the shifted in data.
+const Int32 F2_MOTO_DISPENSER_A1_1_AMT_OF_WORDS = 0x328 ; // The amount of spi words (usually byte sized) per transmission.
+const Int32 F2_MOTO_DISPENSER_A1_2_TX_00 = 0x330 ; // The second register to be shifted out of the spi. The msb bit of this register is shifted out first.
+const Int32 F2_MOTO_DISPENSER_A1_2_TX_01 = 0x332 ; // The first register to be shifted out of the spi. The msb bit of this register is shifted out first.
+const Int32 F2_MOTO_DISPENSER_A1_2_RX_00 = 0x334 ; // The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros.
+const Int32 F2_MOTO_DISPENSER_A1_2_RX_01 = 0x336 ; // The 16 Lsb bits of the shifted in data.
+const Int32 F2_MOTO_DISPENSER_A1_2AMT_OF_WORDS = 0x338 ; // The amount of spi words (usually byte sized) per transmission.
+const Int32 F2_MOTO_DISPENSER_A1_3_TX_00 = 0x340 ; // The second register to be shifted out of the spi. The msb bit of this register is shifted out first.
+const Int32 F2_MOTO_DISPENSER_A1_3_TX_01 = 0x342 ; // The first register to be shifted out of the spi. The msb bit of this register is shifted out first.
+const Int32 F2_MOTO_DISPENSER_A1_3_RX_00 = 0x344 ; // The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros.
+const Int32 F2_MOTO_DISPENSER_A1_3_RX_01 = 0x346 ; // The 16 Lsb bits of the shifted in data.
+const Int32 F2_MOTO_DISPENSER_A1_3_AMT_OF_WORDS = 0x348 ; // The amount of spi words (usually byte sized) per transmission.
+const Int32 F2_MOTO_DISPENSER_A1_4_TX_00 = 0x350 ; // The second register to be shifted out of the spi. The msb bit of this register is shifted out first.
+const Int32 F2_MOTO_DISPENSER_A1_4_TX_01 = 0x352 ; // The first register to be shifted out of the spi. The msb bit of this register is shifted out first.
+const Int32 F2_MOTO_DISPENSER_A1_4_RX_00 = 0x354 ; // The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros.
+const Int32 F2_MOTO_DISPENSER_A1_4_RX_01 = 0x356 ; // The 16 Lsb bits of the shifted in data.
+const Int32 F2_MOTO_DISPENSER_A1_4_AMT_OF_WORDS = 0x358 ; // The amount of spi words (usually byte sized) per transmission.
+const Int32 F2_MOTO_DISPENSER_A1_5_TX_00 = 0x360 ; // The second register to be shifted out of the spi. The msb bit of this register is shifted out first.
+const Int32 F2_MOTO_DISPENSER_A1_5_TX_01 = 0x362 ; // The first register to be shifted out of the spi. The msb bit of this register is shifted out first.
+const Int32 F2_MOTO_DISPENSER_A1_5_RX_00 = 0x364 ; // The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros.
+const Int32 F2_MOTO_DISPENSER_A1_5_RX_01 = 0x366 ; // The 16 Lsb bits of the shifted in data.
+const Int32 F2_MOTO_DISPENSER_A1_5_AMT_OF_WORDS = 0x368 ; // The amount of spi words (usually byte sized) per transmission.
+const Int32 F2_MOTO_DISPENSER_A1_6_TX_00 = 0x370 ; // The second register to be shifted out of the spi. The msb bit of this register is shifted out first.
+const Int32 F2_MOTO_DISPENSER_A1_6_TX_01 = 0x372 ; // The first register to be shifted out of the spi. The msb bit of this register is shifted out first.
+const Int32 F2_MOTO_DISPENSER_A1_6_RX_00 = 0x374 ; // The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros.
+const Int32 F2_MOTO_DISPENSER_A1_6_RX_01 = 0x376 ; // The 16 Lsb bits of the shifted in data.
+const Int32 F2_MOTO_DISPENSER_A1_6_AMT_OF_WORDS = 0x378 ; // The amount of spi words (usually byte sized) per transmission.
+const Int32 F2_MOTO_DISPENSER_A1_7_TX_00 = 0x380 ; // The second register to be shifted out of the spi. The msb bit of this register is shifted out first.
+const Int32 F2_MOTO_DISPENSER_A1_7_TX_01 = 0x382 ; // The first register to be shifted out of the spi. The msb bit of this register is shifted out first.
+const Int32 F2_MOTO_DISPENSER_A1_7_RX_00 = 0x384 ; // The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros.
+const Int32 F2_MOTO_DISPENSER_A1_7_RX_01 = 0x386 ; // The 16 Lsb bits of the shifted in data.
+const Int32 F2_MOTO_DISPENSER_A1_7_AMT_OF_WORDS = 0x388 ; // The amount of spi words (usually byte sized) per transmission.
+const Int32 F2_MOTO_DISPENSER_A1_8_TX_00 = 0x390 ; // The second register to be shifted out of the spi. The msb bit of this register is shifted out first.
+const Int32 F2_MOTO_DISPENSER_A1_8_TX_01 = 0x392 ; // The first register to be shifted out of the spi. The msb bit of this register is shifted out first.
+const Int32 F2_MOTO_DISPENSER_A1_8_RX_00 = 0x394 ; // The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros.
+const Int32 F2_MOTO_DISPENSER_A1_8_RX_01 = 0x396 ; // The 16 Lsb bits of the shifted in data.
+const Int32 F2_MOTO_DISPENSER_A1_8_AMT_OF_WORDS = 0x398 ; // The amount of spi words (usually byte sized) per transmission.
+
+
+
+const Int32 F3_MOTO_SPARE1_1_A1_TX_00 = 0x200 ;
+const Int32 F3_MOTO_SPARE1_1_A1_TX_01 = 0x202 ;
+const Int32 F3_MOTO_SPARE1_1_A1_RX_00 = 0x204 ;
+const Int32 F3_MOTO_SPARE1_1_A1_RX_01 = 0x206 ;
+const Int32 F3_MOTO_SPARE1_1_A1_AMT_OF_WORDS = 0x208 ;
+const Int32 F3_MOTO_SPARE1_2_A1_TX_00 = 0x210 ;
+const Int32 F3_MOTO_SPARE1_2_A1_TX_01 = 0x212 ;
+const Int32 F3_MOTO_SPARE1_2_A1_RX_00 = 0x214 ;
+const Int32 F3_MOTO_SPARE1_2_A1_RX_01 = 0x216 ;
+const Int32 F3_MOTO_SPARE1_2_A1_AMT_OF_WORDS = 0x218 ;
+const Int32 F3_MOTO_SPARE2_1_A1_TX_00 = 0x220 ;
+const Int32 F3_MOTO_SPARE2_1_A1_TX_01 = 0x222 ;
+const Int32 F3_MOTO_SPARE2_1_A1_RX_00 = 0x224 ;
+const Int32 F3_MOTO_SPARE2_1_A1_RX_01 = 0x226 ;
+const Int32 F3_MOTO_SPARE2_1_A1_AMT_OF_WORDS = 0x228 ;
+const Int32 F3_MOTO_SPARE2_2_A1_TX_00 = 0x230 ;
+const Int32 F3_MOTO_SPARE2_2_A1_TX_01 = 0x232 ;
+const Int32 F3_MOTO_SPARE2_2_A1_RX_00 = 0x234 ;
+const Int32 F3_MOTO_SPARE2_2_A1_RX_01 = 0x236 ;
+const Int32 F3_MOTO_SPARE2_2_A1_AMT_OF_WORDS = 0x238 ;
+
+
+/*** Spare Motor ***/
+const Int32 F3_MOTO_SPARE3_1_A1_TX_00 = 0x240;
+const Int32 F3_MOTO_SPARE3_1_A1_TX_01 = 0x242;
+const Int32 F3_MOTO_SPARE3_1_A1_RX_00 = 0x244;
+const Int32 F3_MOTO_SPARE3_1_A1_RX_01 = 0x246;
+const Int32 F3_MOTO_SPARE3_1_A1_AMT_OF_WORDS = 0x248;
+
+/*** Motor Driver Commands ***/
+const Int32 MOTORDRIVER_HIGHZ_COMMAND_MSB = 0xa800;
+const Int32 MOTORDRIVER_HIGHZ_COMMAND_LSB = 0x0000;
+
+const Int32 MOTORDRIVER_RUN_COMMAND_MSB = 0x5000;
+const Int32 MOTORDRIVER_RUN_COMMAND_LSB = 0x0000;
+
+const Int32 MOTORDRIVER_MOVE_COMMAND_MSB = 0x4000;
+const Int32 MOTORDRIVER_MOVE_COMMAND_LSB = 0x0000;
+
+const Int32 MOTORDRIVER_RDCFG_COMMAND_MSB = 0x3800;
+const Int32 MOTORDRIVER_RDCFG_COMMAND_LSB = 0x0000;
+
+const Int32 MOTORDRIVER_RDSTATUS_COMMAND_MSB = 0x3900;
+const Int32 MOTORDRIVER_RDSTATUS_COMMAND_LSB = 0x0000;
+
+const Int32 MOTORDRIVER_RDSTEPREG_COMMAND_MSB = 0x3600;
+const Int32 MOTORDRIVER_RDSTEPREG_COMMAND_LSB = 0x0000;
+
+const Int32 MOTORDRIVER_WRSTEPREG_COMMAND_MSB = 0x1600;
+const Int32 MOTORDRIVER_WRSTEPREG_COMMAND_LSB = 0x0000;
+
+const Int32 MOTORDRIVER_GETSTATUS_COMMAND_MSB = 0xd000;
+const Int32 MOTORDRIVER_GETSTATUS_COMMAND_LSB = 0x0000;
+
+int Motor_OutOfReset()
+{
+
+ //Pull all L6470 motor drivers out of reset
+ Fpga_Write_Reg(FPGA1, F1_Moto_Driver_NSTBYRST1, 0x07ff,0);
+ Fpga_Write_Reg(FPGA1, F1_Moto_Driver_NSTBYRST2, 0x003f,0);
+ Fpga_Write_Reg(FPGA2, F2_Moto_Driver_NSTBYRST1, 0x00ff,0);
+ Fpga_Write_Reg(FPGA3, F3_Moto_Driver_NSTBYRST1, 0x001f,0);
+
+ /*
+ Fpga_Read_Reg(FPGA1, F1_Moto_Driver_NSTBYRST1,0);
+ Fpga_Read_Reg(FPGA1, F1_Moto_Driver_NSTBYRST2,0);
+ Fpga_Read_Reg(FPGA2, F2_Moto_Driver_NSTBYRST1,0);
+ Fpga_Read_Reg(FPGA3, F3_Moto_Driver_NSTBYRST1,0);
+ */
+ return 1;
+
+}
+
+int Motor_DriverReset()
+{
+ Fpga_Write_Reg(FPGA1, F1_Moto_Driver_NSTBYRST1, 0x0000,0);
+ Fpga_Write_Reg(FPGA1, F1_Moto_Driver_NSTBYRST2, 0x0000,0);
+ Fpga_Write_Reg(FPGA2, F2_Moto_Driver_NSTBYRST1, 0x0000,0);
+ Fpga_Write_Reg(FPGA3, F3_Moto_Driver_NSTBYRST1, 0x0000,0);
+
+ return 1;
+}
+
+int Motor_HighZ(Int32 Fpga, Int32 HighAdr, Int32 LowAdr)
+{
+
+ Fpga_Write_Reg(Fpga, HighAdr, MOTORDRIVER_HIGHZ_COMMAND_MSB,0);
+ Fpga_Write_Reg(Fpga, LowAdr, MOTORDRIVER_HIGHZ_COMMAND_LSB,0);
+
+ return 1;
+}
+
+int Motor_Run(Int32 Fpga, Int32 HighAdr, Int32 LowAdr, Int32 Speed, Int32 Direction)
+{
+
+ var RunCmdHigh = ( ((MOTORDRIVER_RUN_COMMAND_MSB >> 8) + (Direction & 0x1)) << 8 ) + ( (Speed & 0x0fffff) >> 16);
+ var RunCmdLow = (Speed & 0xffff);
+
+ Fpga_Write_Reg(Fpga, HighAdr, RunCmdHigh, 0);
+ Fpga_Write_Reg(Fpga, LowAdr, RunCmdLow, 0);
+
+ return 1;
+}
+
+int Motor_Move(Int32 Fpga, Int32 HighAdr, Int32 LowAdr, Int32 NumOfSteps, Int32 Direction)
+{
+
+ var MoveCmdHigh = ( ((MOTORDRIVER_MOVE_COMMAND_MSB >> 8) + (Direction & 0x1)) << 8 ) + ( (NumOfSteps & 0x3fffff) >> 16);
+ var MoveCmdLow = (NumOfSteps & 0xffff);
+
+ Fpga_Write_Reg(Fpga, HighAdr, MoveCmdHigh, 0);
+ Fpga_Write_Reg(Fpga, LowAdr, MoveCmdLow, 0);
+
+ return 1;
+}
+
+int Motor_Move_Loop(Int32 Fpga, Int32 HighAdr, Int32 LowAdr, Int32 NumOfSteps, Int32 Direction, Int32 NumOfLoops)
+{
+
+ for (int i = 0; i < NumOfLoops; i++)
+ {
+ Motor_Move(Fpga, HighAdr, LowAdr, NumOfSteps, Direction);
+ Thread.Sleep(1000);
+ Motor_Move(Fpga, HighAdr, LowAdr, NumOfSteps, Direction^0x1);
+ Thread.Sleep(1000);
+ }
+ return 1;
+
+}
+
+int Motor_Move_Loop_Screw(Int32 Fpga, Int32 HighAdr, Int32 LowAdr, Int32 NumOfSteps, Int32 Direction, Int32 NumOfLoops)
+{
+ Int32 Bit = 0;
+ for (int i = 0; i < NumOfLoops; i++)
+ {
+ Motor_Move(Fpga, HighAdr, LowAdr, NumOfSteps, Direction);
+ Bit = GetBit(FPGA1, F1_Moto_Driver_NBUSY2_Direct, 1);
+ while (Bit == 0x0)
+ {
+ Bit = GetBit(FPGA1, F1_Moto_Driver_NBUSY2_Direct, 1);
+ }
+
+ Motor_Move(Fpga, HighAdr, LowAdr, NumOfSteps, Direction^0x1);
+ Bit = GetBit(FPGA1, F1_Moto_Driver_NBUSY2_Direct, 1);
+ while (Bit == 0x0)
+ {
+ Bit = GetBit(FPGA1, F1_Moto_Driver_NBUSY2_Direct, 1);
+ }
+
+ }
+ return 1;
+
+}
+
+
+
+int Motor_ReadCfg(Int32 Fpga, Int32 HighAdr, Int32 LowAdr)
+{
+
+ Fpga_Write_Reg(Fpga, HighAdr, MOTORDRIVER_RDCFG_COMMAND_MSB, 0);
+ Fpga_Write_Reg(Fpga, LowAdr, MOTORDRIVER_RDCFG_COMMAND_LSB, 0);
+ Fpga_Read_Reg(Fpga, HighAdr+4, 1);
+ Fpga_Read_Reg(Fpga, LowAdr+4, 1);
+
+ return 1;
+}
+
+int Motor_ReadStatus(Int32 Fpga, Int32 HighAdr, Int32 LowAdr)
+{
+
+ Fpga_Write_Reg(Fpga, HighAdr, MOTORDRIVER_RDSTATUS_COMMAND_MSB, 0);
+ Fpga_Write_Reg(Fpga, LowAdr, MOTORDRIVER_RDSTATUS_COMMAND_LSB, 0);
+ Fpga_Read_Reg(Fpga, HighAdr+4, 1);
+ Fpga_Read_Reg(Fpga, LowAdr+4, 1);
+
+ return 1;
+}
+
+int Motor_GetStatus(Int32 Fpga, Int32 HighAdr, Int32 LowAdr)
+{
+
+ Fpga_Write_Reg(Fpga, HighAdr, MOTORDRIVER_GETSTATUS_COMMAND_MSB, 0);
+ Fpga_Write_Reg(Fpga, LowAdr, MOTORDRIVER_GETSTATUS_COMMAND_LSB, 0);
+ Fpga_Read_Reg(Fpga, HighAdr+4, 1);
+ Fpga_Read_Reg(Fpga, LowAdr+4, 1);
+
+ return 1;
+}
+
+
+// ParaData1 shall be left justified i.e. <Byte1><Byte0><0x00><0x00>
+int Motor_SetParam(Int32 Fpga, Int32 HighAdr, Int32 LowAdr, Int32 ParaAddr, uint ParaData1)
+{
+
+ Int32 Temp = 0;
+ Temp = (ParaAddr << 8 ) + ( (Int32) ParaData1 >> 24);
+ Fpga_Write_Reg(Fpga, HighAdr, Temp, 0);
+ Temp = ((Int32)ParaData1 >> 8) & 0xffff;
+ Fpga_Write_Reg(Fpga, LowAdr, Temp, 0);
+ Thread.Sleep(50);
+ //Fpga_Read_Reg(Fpga, HighAdr+4, 1);
+ //Fpga_Read_Reg(Fpga, LowAdr+4, 1);
+
+ return 1;
+}
+
+int Motor_GetParam(Int32 Fpga, Int32 HighAdr, Int32 LowAdr, Int32 ParaAddr)
+{
+
+ Int32 Temp = 0;
+ Temp = (ParaAddr + 0x20) << 8 ;
+ Fpga_Write_Reg(Fpga, HighAdr, Temp, 0);
+ Temp = 0x0;
+ Fpga_Write_Reg(Fpga, LowAdr, Temp, 0);
+ Fpga_Read_Reg(Fpga, HighAdr+4, 1);
+ Fpga_Read_Reg(Fpga, LowAdr+4, 1);
+
+ return 1;
+}
+
+/*
+int Motor_IsBusy(Int32 Fpga, Int32 HighAdr, Int32 LowAdr, Int32 BusyRegister, Int32 BusyBitNo)
+{
+ int temp1 = 0;
+ int tmp3 = 0;
+
+ tmp3 = (int) GetBit(Fpga, F2_SPI_Busy1_Direct, BusyBitNo);
+
+ while ( tmp3 == 1)
+ {
+ tmp3 = (int) GetBit(Fpga, F2_SPI_Busy1_Direct, BusyBitNo);
+ stubManager.Write("\n\nBUSY");
+ }
+
+ var RV_High = Fpga_Read_Reg(Fpga, HighAdr+4, 0);
+ var RV_Low = Fpga_Read_Reg(Fpga, LowAdr+4, 0);
+
+ temp = ( (int) RV_High.Value << 16) + (int) RV_Low.Value;
+
+ return temp;
+
+}
+*/
+
+/*
+int Motor_SetStep(Int32 Fpga, Int32 HighAdr, Int32 LowAdr, Int32 StepVal)
+{
+
+ var RetVal = Fpga_Read_Reg(Fpga, HighAdr+4, 1);
+ Fpga_Read_Reg(Fpga, LowAdr+4, 1);
+ Fpga_Write_Reg(Fpga, HighAdr, MOTORDRIVER_RDCFG_COMMAND_MSB, 1);
+ Fpga_Write_Reg(Fpga, LowAdr, MOTORDRIVER_RDCFG_COMMAND_LSB, 1);
+
+}
+const Int32 MOTORDRIVER_RDSTEPREG_COMMAND_MSB = 0x3600;
+const Int32 MOTORDRIVER_RDSTEPREG_COMMAND_LSB = 0x0000;
+
+const Int32 MOTORDRIVER_WRSTEPREG_COMMAND_MSB = 0x1600;
+const Int32 MOTORDRIVER_WRSTEPREG_COMMAND_LSB = 0x0000;
+*/
diff --git a/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_PT100.cs b/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_PT100.cs
new file mode 100644
index 000000000..c1a5511f9
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_PT100.cs
@@ -0,0 +1,219 @@
+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 F2_ANALOG_DYEINGH_TEMP1_1_TX_00 = 0x200 ;
+const Int32 F2_ANALOG_DYEINGH_TEMP1_1_TX_01 = 0x202 ;
+const Int32 F2_ANALOG_DYEINGH_TEMP1_1_RX_00 = 0x204 ;
+const Int32 F2_ANALOG_DYEINGH_TEMP1_1_RX_01 = 0x206 ;
+const Int32 F2_ANALOG_DYEINGH_TEMP1_1_AMT_OF_WORDS = 0x208 ;
+const Int32 F2_AN_ENCLOSURETEMP1_1_TX_00 = 0x210 ;
+const Int32 F2_AN_ENCLOSURETEMP1_1_TX_01 = 0x212 ;
+const Int32 F2_AN_ENCLOSURETEMP1_1_RX_00 = 0x214 ;
+const Int32 F2_AN_ENCLOSURETEMP1_1_RX_01 = 0x216 ;
+const Int32 F2_AN_ENCLOSURETEMP1_1_AMT_OF_WORDS = 0x218 ;
+const Int32 F2_ANALOG_DYEINGH_TEMP2_1_TX_00 = 0x220 ;
+const Int32 F2_ANALOG_DYEINGH_TEMP2_1_TX_01 = 0x222 ;
+const Int32 F2_ANALOG_DYEINGH_TEMP2_1_RX_00 = 0x224 ;
+const Int32 F2_ANALOG_DYEINGH_TEMP2_1_RX_01 = 0x226 ;
+const Int32 F2_ANALOG_DYEINGH_TEMP2_1_AMT_OF_WORDS = 0x228 ;
+const Int32 F2_AN_ENCLOSURETEMP2_1_TX_00 = 0x230 ;
+const Int32 F2_AN_ENCLOSURETEMP2_1_TX_01 = 0x232 ;
+const Int32 F2_AN_ENCLOSURETEMP2_1_RX_00 = 0x234 ;
+const Int32 F2_AN_ENCLOSURETEMP2_1_RX_01 = 0x236 ;
+const Int32 F2_AN_ENCLOSURETEMP2_1_AMT_OF_WORDS = 0x238 ;
+const Int32 F2_ANALOG_DYEINGH_TEMP3_1_TX_00 = 0x240 ;
+const Int32 F2_ANALOG_DYEINGH_TEMP3_1_TX_01 = 0x242 ;
+const Int32 F2_ANALOG_DYEINGH_TEMP3_1_RX_00 = 0x244 ;
+const Int32 F2_ANALOG_DYEINGH_TEMP3_1_RX_01 = 0x246 ;
+const Int32 F2_ANALOG_DYEINGH_TEMP3_1_AMT_OF_WORDS = 0x248 ;
+const Int32 F2_AN_ENCLOSURETEMP3_1_TX_00 = 0x250 ;
+const Int32 F2_AN_ENCLOSURETEMP3_1_TX_01 = 0x252 ;
+const Int32 F2_AN_ENCLOSURETEMP3_1_RX_00 = 0x254 ;
+const Int32 F2_AN_ENCLOSURETEMP3_1_RX_01 = 0x256 ;
+const Int32 F2_AN_ENCLOSURETEMP3_1_AMT_OF_WORDS = 0x258 ;
+const Int32 F2_ANALOG_DYEINGH_TEMP4_1_TX_00 = 0x260 ;
+const Int32 F2_ANALOG_DYEINGH_TEMP4_1_TX_01 = 0x262 ;
+const Int32 F2_ANALOG_DYEINGH_TEMP4_1_RX_00 = 0x264 ;
+const Int32 F2_ANALOG_DYEINGH_TEMP4_1_RX_01 = 0x266 ;
+const Int32 F2_ANALOG_DYEINGH_TEMP4_1_AMT_OF_WORDS = 0x268 ;
+const Int32 F2_ANALOG_DRYER_TEMP1_1_TX_00 = 0x270 ;
+const Int32 F2_ANALOG_DRYER_TEMP1_1_TX_01 = 0x272 ;
+const Int32 F2_ANALOG_DRYER_TEMP1_1_RX_00 = 0x274 ;
+const Int32 F2_ANALOG_DRYER_TEMP1_1_RX_01 = 0x276 ;
+const Int32 F2_ANALOG_DRYER_TEMP1_1_AMT_OF_WORDS = 0x278 ;
+const Int32 F2_ANALOG_DYEINGH_TEMP5_1_TX_00 = 0x280 ;
+const Int32 F2_ANALOG_DYEINGH_TEMP5_1_TX_01 = 0x282 ;
+const Int32 F2_ANALOG_DYEINGH_TEMP5_1_RX_00 = 0x284 ;
+const Int32 F2_ANALOG_DYEINGH_TEMP5_1_RX_01 = 0x286 ;
+const Int32 F2_ANALOG_DYEINGH_TEMP5_1_AMT_OF_WORDS = 0x288 ;
+const Int32 F2_ANALOG_DRYER_TEMP2_1_TX_00 = 0x290 ;
+const Int32 F2_ANALOG_DRYER_TEMP2_1_TX_01 = 0x292 ;
+const Int32 F2_ANALOG_DRYER_TEMP2_1_RX_00 = 0x294 ;
+const Int32 F2_ANALOG_DRYER_TEMP2_1_RX_01 = 0x296 ;
+const Int32 F2_ANALOG_DRYER_TEMP2_1_AMT_OF_WORDS = 0x298 ;
+const Int32 F2_ANALOG_MIXCHIP_TEMP_1_TX_00 = 0x2A0 ;
+const Int32 F2_ANALOG_MIXCHIP_TEMP_1_TX_01 = 0x2A2 ;
+const Int32 F2_ANALOG_MIXCHIP_TEMP_1_RX_00 = 0x2A4 ;
+const Int32 F2_ANALOG_MIXCHIP_TEMP_1_RX_01 = 0x2A6 ;
+const Int32 F2_ANALOG_MIXCHIP_TEMP_1_AMT_OF_WORDS = 0x2A8 ;
+const Int32 F2_ANALOG_DRYER_TEMP3_1_TX_00 = 0x2B0 ;
+const Int32 F2_ANALOG_DRYER_TEMP3_1_TX_01 = 0x2B2 ;
+const Int32 F2_ANALOG_DRYER_TEMP3_1_RX_00 = 0x2B4 ;
+const Int32 F2_ANALOG_DRYER_TEMP3_1_RX_01 = 0x2B6 ;
+const Int32 F2_ANALOG_DRYER_TEMP3_1_AMT_OF_WORDS = 0x2B8 ;
+
+
+
+const Int32 F2_SPI_Busy1_Direct = 0x090; // Reads the direct values that are currently being sent to the fpga. spi_busy15 spi_busy14 spi_busy13 spi_busy12 F2_AN_ENCLOSURETEMP3_1_BUSY F2_AN_ENCLOSURETEMP2_1_BUSY F2_AN_ENCLOSURETEMP1_1_BUSY F2_ANALOG_MIXCHIP_TEMP_1_BUSY F2_ANALOG_DYEINGH_TEMP5_1_BUSY F2_ANALOG_DYEINGH_TEMP4_1_BUSY F2_ANALOG_DYEINGH_TEMP3_1_BUSY F2_ANALOG_DYEINGH_TEMP2_1_BUSY F2_ANALOG_DYEINGH_TEMP1_1_BUSY F2_ANALOG_DRYER_TEMP3_1_BUSY F2_ANALOG_DRYER_TEMP2_1_BUSY F2_ANALOG_DRYER_TEMP1_1_BUSY
+
+const Int32 F2_Prescaler1_reg3 = 0x3e4; // Parameter for prescaler divisions - 3bit spi temp low duty cycle value for pmw rsv rsv rsv rsv rsv rsv rsv rsv rsv rsv rsv rsv rsv parambit2 parambit1 parambit0
+const Int32 F2_Prescaler1_reg4 = 0x3e6; // Parameter for prescaler divisions - 3bit spi temp high duty cycle value for pmw rsv rsv rsv rsv rsv rsv rsv rsv rsv rsv rsv rsv rsv parambit2 parambit1 parambit0
+
+const Int32 ADS1220_RESET = 0x06 ; // RESET Reset the device 0000 011x
+const Int32 ADS1220_START_SYNC = 0x08 ; // START/SYNC Start or restart conversions 0000 100x
+const Int32 ADS1220_POWERDOWN = 0x02 ; // POWERDOWN Enter power-down mode 0000 001x
+const Int32 ADS1220_RDATA = 0x10 ; // RDATA Read data by command 0001 xxxx
+const Int32 ADS1220_RREG = 0x20 ; // RREG Read nn registers starting at address rr 0010 rrnn
+const Int32 ADS1220_WREG = 0x40 ; // WREG Write nn registers starting at address rr 0010 rrnn
+
+int ADS1220_Reset(Int32 Fpga, Int32 HighAdr, Int32 LowAdr)
+{
+ //Amount of words = 1
+ Fpga_Write_Reg(Fpga, HighAdr+6, 0x1, 0);
+ Fpga_Write_Reg(Fpga, HighAdr, (ADS1220_RESET ) << 8, 0);
+ Fpga_Write_Reg(Fpga, LowAdr, 0x0000, 0);
+
+ return 1;
+}
+
+
+Int32 ADS1220_LoadOutReg(Int32 Fpga, Int32 HighAdr, Int32 LowAdr, Int32 BusyBitNo)
+{
+
+ int tmp3 = 0;
+ Int32 temp = 0;
+
+ //Amount of words = 4
+ Fpga_Write_Reg(Fpga, HighAdr+6, 0x4, 0);
+ Fpga_Write_Reg(Fpga, HighAdr, (ADS1220_RDATA ) << 8, 0);
+ Fpga_Write_Reg(Fpga, LowAdr, 0x0000, 0);
+
+ tmp3 = (int) GetBit(Fpga, F2_SPI_Busy1_Direct, BusyBitNo);
+
+ while ( tmp3 == 1)
+ {
+ tmp3 = (int) GetBit(Fpga, F2_SPI_Busy1_Direct, BusyBitNo);
+ stubManager.Write("\n\nBUSY");
+ }
+
+ var RV_High = Fpga_Read_Reg(Fpga, HighAdr+4, 0);
+ var RV_Low = Fpga_Read_Reg(Fpga, LowAdr+4, 0);
+
+ temp = ( (Int32) RV_High.Value << 16) + (Int32) RV_Low.Value;
+
+ return temp;
+
+}
+int ADS1220_ReadReg(Int32 Fpga, Int32 HighAdr, Int32 LowAdr, Int32 RegAddr, Int32 BusyBitNo)
+{
+
+ int temp = 0;
+ int tmp3 = 0;
+
+
+ //Amount of words = 2
+ Fpga_Write_Reg(Fpga, HighAdr+6, 0x2, 0);
+
+ Fpga_Write_Reg(Fpga, HighAdr, (ADS1220_RREG + (RegAddr << 2 )) << 8, 0);
+ Fpga_Write_Reg(Fpga, LowAdr, 0x0000, 0);
+
+
+ tmp3 = (int) GetBit(Fpga, F2_SPI_Busy1_Direct, BusyBitNo);
+
+ while ( tmp3 == 1)
+ {
+ tmp3 = (int) GetBit(Fpga, F2_SPI_Busy1_Direct, BusyBitNo);
+ stubManager.Write("\n\nBUSY");
+ }
+
+ var RV_High = Fpga_Read_Reg(Fpga, HighAdr+4, 0);
+ var RV_Low = Fpga_Read_Reg(Fpga, LowAdr+4, 0);
+
+ temp = ( (int) RV_High.Value << 16) + (int) RV_Low.Value;
+
+ return temp;
+
+}
+
+int ADS1220_WriteReg(Int32 Fpga, Int32 HighAdr, Int32 LowAdr, Int32 RegAddr, Int32 Data)
+{
+
+ int temp = 0;
+ int tmp3 = 0;
+
+ //Amount of words = 2
+ Fpga_Write_Reg(Fpga, HighAdr+6, 0x2, 0);
+
+ Fpga_Write_Reg(Fpga, HighAdr, ((ADS1220_WREG + (RegAddr << 2) ) << 8) + (Data & 0xff), 0);
+ Fpga_Write_Reg(Fpga, LowAdr, 0x0000, 0);
+
+ return 1;
+
+}
+
+int ADS1220_StartSync(Int32 Fpga, Int32 HighAdr, Int32 LowAdr)
+{
+ //Amount of words = 1
+ Fpga_Write_Reg(Fpga, HighAdr+6, 0x1, 0);
+ Fpga_Write_Reg(Fpga, HighAdr, (ADS1220_START_SYNC ) << 8, 0);
+ Fpga_Write_Reg(Fpga, LowAdr, 0x0000, 0);
+
+ return 1;
+}
+
+/*
+int ADS1220_GetContiniuosConvertion(Int32 Fpga, Int32 HighAdr, Int32 LowAdr)
+{
+ //Amount of words = 1
+ Fpga_Write_Reg(Fpga, HighAdr+6, 0x1, 0);
+ Fpga_Write_Reg(Fpga, HighAdr, (ADS1220_START_SYNC ) << 8, 0);
+ Fpga_Write_Reg(Fpga, LowAdr, 0x0000, 0);
+}
+
+*/
+Int32 ADS1220_GetConvertion(Int32 Fpga, Int32 HighAdr, Int32 LowAdr, Int32 BusyBitNo)
+{
+ int tmp3 = 0;
+ Int32 temp = 0;
+
+ //Amount of words = 3
+ Fpga_Write_Reg(Fpga, HighAdr+6, 0x3, 0);
+
+ Fpga_Write_Reg(Fpga, HighAdr, 0x0000, 0);
+ Fpga_Write_Reg(Fpga, LowAdr, 0x0000, 0);
+
+ tmp3 = (int) GetBit(Fpga, F2_SPI_Busy1_Direct, BusyBitNo);
+
+ while ( tmp3 == 1)
+ {
+ tmp3 = (int) GetBit(Fpga, F2_SPI_Busy1_Direct, BusyBitNo);
+ stubManager.Write("\n\nBUSY");
+ }
+
+ var RV_High = Fpga_Read_Reg(Fpga, HighAdr+4, 0);
+ var RV_Low = Fpga_Read_Reg(Fpga, LowAdr+4, 0);
+
+ temp = ( (Int32) RV_High.Value << 16) + (Int32) RV_Low.Value;
+
+ return temp;
+}
diff --git a/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_QEI.cs b/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_QEI.cs
new file mode 100644
index 000000000..aedf9526d
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_QEI.cs
@@ -0,0 +1,37 @@
+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;
+
+Int32 F1_SCREW_ROTENC_lsb = 0x100 ; // Value of the lsb of the QEI register
+Int32 F1_SCREW_ROTENC_msb = 0x102 ; // 10bits Value of the Msb of the QEI register, 1bit Direction of movement, 5bits Reserved
+Int32 F1_SCREW_ROTENC_index = 0x104 ; // value of index counter
+Int32 F1_RSPARE_ROTENC_lsb = 0x110 ; // Value of the lsb of the QEI register
+Int32 F1_RSPARE_ROTENC_msb = 0x112 ; // 10bits Value of the Msb of the QEI register, 1bit Direction of movement, 5bits Reserved
+Int32 F1_RSPARE_ROTENC_index = 0x114 ; // value of index counter
+Int32 F1_LSPARE1_ROTENC_lsb = 0x120 ; // Value of the lsb of the QEI register
+Int32 F1_LSPARE1_ROTENC_msb = 0x122 ; // 10bits Value of the Msb of the QEI register, 1bit Direction of movement, 5bits Reserved
+Int32 F1_LSPARE1_ROTENC_index = 0x124 ; // value of index counter
+Int32 F1_RSPEEDSENS_ROTENC_lsb = 0x130 ; // Value of the lsb of the QEI register
+Int32 F1_RSPEEDSENS_ROTENC_msb = 0x132 ; // 10bits Value of the Msb of the QEI register, 1bit Direction of movement, 5bits Reserved
+Int32 F1_RSPEEDSENS_ROTENC_index = 0x134 ; // value of index counter
+Int32 F1_LSPARE2_ROTENC_lsb = 0x140 ; // Value of the lsb of the QEI register
+Int32 F1_LSPARE2_ROTENC_msb = 0x142 ; // 10bits Value of the Msb of the QEI register, 1bit Direction of movement, 5bits Reserved
+Int32 F1_LSPARE2_ROTENC_index = 0x144 ; // value of index counter
+Int32 F1_DRYER_LOADARM_ROTENC_lsb = 0x150 ; // Value of the lsb of the QEI register
+Int32 F1_DRYER_LOADARM_ROTENC_msb = 0x152 ; // 10bits Value of the Msb of the QEI register, 1bit Direction of movement, 5bits Reserved
+Int32 F1_DRYER_LOADARM_ROTENC_index = 0x154 ; // value of index counter
+Int32 F3_SPARE1_ROTENC_lsb = 0x100 ; // Value of the lsb of the QEI register
+Int32 F3_SPARE1_ROTENC_msb = 0x102 ; // 10bits Value of the Msb of the QEI register, 1bit Direction of movement, 5bits Reserved
+Int32 F3_SPARE1_ROTENC_index = 0x104 ; // value of index counter
+Int32 F3_RSPARE_ROTENC_lsb = 0x110 ; // Value of the lsb of the QEI register
+Int32 F3_RSPARE_ROTENC_msb = 0x112 ; // 10bits Value of the Msb of the QEI register, 1bit Direction of movement, 5bits Reserved
+Int32 F3_RSPARE_ROTENC_index = 0x114 ; // value of index counter
+
diff --git a/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_SSI.cs b/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_SSI.cs
new file mode 100644
index 000000000..8cc9f511c
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_SSI.cs
@@ -0,0 +1,131 @@
+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;
+
+
+/*** LTFU SSI Encoders ***/
+const Int32 F1_LDANCER1_ROTENC_MSB = 0x01c2;
+const Int32 F1_LDANCER1_ROTENC_LSB = 0x01c0;
+const Int32 F1_LDANCER1_ROTENC_TX = 0x01ce;
+
+const Int32 F1_LDANCER2_ROTENC_MSB = 0x01b2;
+const Int32 F1_LDANCER2_ROTENC_LSB = 0x01b0;
+const Int32 F1_LDANCER2_ROTENC_TX = 0x01be;
+
+const Int32 F1_LSPARE_ROTENC_MSB = 0x0192;
+const Int32 F1_LSPARE_ROTENC_LSB = 0x0190;
+const Int32 F1_LSPARE_ROTENC_TX = 0x019e;
+
+/*** RTFU SSI Encoders ***/
+const Int32 F1_RDANCER_ROTENC_MSB = 0x01a2;
+const Int32 F1_RDANCER_ROTENC_LSB = 0x01a0;
+const Int32 F1_RDANCER_ROTENC_TX = 0x01ae;
+
+const Int32 F1_RSPARE_ROTENC_MSB = 0x0182;
+const Int32 F1_RSPARE_ROTENC_LSB = 0x0180;
+const Int32 F1_RSPARE_ROTENC_TX = 0x018e;
+
+/*** RTFU, LTFU and DISPENSER SSI Prescalers ***/
+const Int32 F1_Prescaler1_reg1 = 0x03e0;
+const Int32 F1_Prescaler1_reg2 = 0x03e2;
+const Int32 F1_SPI_Busy1_Direct = 0x0090;
+
+const Int32 F2_Prescaler1_reg1 = 0x03e0;
+const Int32 F2_Prescaler1_reg2 = 0x03e2;
+
+const Int32 F3_Prescaler1_reg1 = 0x03e0;
+const Int32 F3_Prescaler1_reg2 = 0x03e2;
+
+/*** DISPENSER SSI Encoders ***/
+const Int32 F2_DISPENSER_ROTENC_1_MSB = 0x0182;
+const Int32 F2_DISPENSER_ROTENC_1_LSB = 0x0180;
+const Int32 F2_DISPENSER_ROTENC_1_TX = 0x018e;
+
+const Int32 F2_DISPENSER_ROTENC_2_MSB = 0x0192;
+const Int32 F2_DISPENSER_ROTENC_2_LSB = 0x0190;
+const Int32 F2_DISPENSER_ROTENC_2_TX = 0x019e;
+
+const Int32 F2_DISPENSER_ROTENC_3_MSB = 0x01a2;
+const Int32 F2_DISPENSER_ROTENC_3_LSB = 0x01a0;
+const Int32 F2_DISPENSER_ROTENC_3_TX = 0x01ae;
+
+const Int32 F2_DISPENSER_ROTENC_4_MSB = 0x01b2;
+const Int32 F2_DISPENSER_ROTENC_4_LSB = 0x01b0;
+const Int32 F2_DISPENSER_ROTENC_4_TX = 0x01be;
+
+const Int32 F2_DISPENSER_ROTENC_5_MSB = 0x01c2;
+const Int32 F2_DISPENSER_ROTENC_5_LSB = 0x01c0;
+const Int32 F2_DISPENSER_ROTENC_5_TX = 0x01ce;
+
+const Int32 F2_DISPENSER_ROTENC_6_MSB = 0x01d2;
+const Int32 F2_DISPENSER_ROTENC_6_LSB = 0x01d0;
+const Int32 F2_DISPENSER_ROTENC_6_TX = 0x01de;
+
+const Int32 F2_DISPENSER_ROTENC_7_MSB = 0x01e2;
+const Int32 F2_DISPENSER_ROTENC_7_LSB = 0x01e0;
+const Int32 F2_DISPENSER_ROTENC_7_TX = 0x01ee;
+
+const Int32 F2_DISPENSER_ROTENC_8_MSB = 0x01f2;
+const Int32 F2_DISPENSER_ROTENC_8_LSB = 0x01f0;
+const Int32 F2_DISPENSER_ROTENC_8_TX = 0x01fe;
+
+
+
+
+
+const Int32 F3_SPARE1_ROTENC_MSB = 0x02c0;
+const Int32 F3_SPARE1_ROTENC_LSB = 0x02c2;
+const Int32 F3_SPARE1_ROTENC_TX = 0x02ce;
+
+const Int32 F3_SPARE2_ROTENC_MSB = 0x02d0;
+const Int32 F3_SPARE2_ROTENC_LSB = 0x02d2;
+const Int32 F3_SPARE2_ROTENC_TX = 0x02de;
+
+
+
+
+
+
+
+int ssi_loop(Int32 Addr)
+ {
+ var RetValue = Fpga_Read_Reg(FPGA1, F1_SPI_Busy1_Direct,10);
+ if ( (RetValue.Value&0x1f) == 0)
+ {
+
+ //stubManager.Write("\nWriting to F1 DANCER TX");
+ //Trigger SSI Tx
+ Fpga_Write_Reg(FPGA1, Addr, 0xffff, 0);
+
+ //Wait for SSI sequence to finish
+ Thread.Sleep(800);
+ }
+ RetValue.Value = 1;
+
+ return 1;
+
+ }
+
+int SSI_Read_Write(Int32 Fpga, Int32 HighAdr, Int32 LowAdr, Int32 TxAdr)
+ {
+ var rv1 = Fpga_Read_Reg(Fpga, HighAdr, 0);
+ var rv2 = Fpga_Read_Reg(Fpga, LowAdr, 0);
+ stubManager.Write(" Adr = ");
+ stubManager.WriteHex(TxAdr,4);
+ stubManager.Write(" (");
+ stubManager.WriteHex(rv1.Value,4); stubManager.Write(", ");
+ stubManager.WriteHex(rv2.Value,4); stubManager.Write(")");
+ //if ( (rv2.Value&0x200) == 0x200) stubManager.Write(" Error");
+ Fpga_Write_Reg(Fpga, TxAdr, 0xffff, 0);
+ Thread.Sleep(100);
+
+ return 1;
+ } \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_SSR.cs b/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_SSR.cs
new file mode 100644
index 000000000..4dbbc8eb4
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_SSR.cs
@@ -0,0 +1,22 @@
+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;
+
+
+
+//Reg Name Functionlity/Contents D15 D14 D13 D12 D11 D10 D9 D8 D7 D6 D5 D4 D3 D2 D1 D0
+const Int32 F2_CTRL = 0x0E2; // Writes to values. Readback the values that are currently in the GPO register rsv rsv rsv rsv F2_GPO_PDOWN_RL1_CTRL F2_GPO_DRYER_SSR1_CTRL F2_GPO_DRYER_SSR2_CTRL F2_GPO_DRYER_SSR3_CTRL F2_GPO_MIXCHIP_SSR4_CTRL F2_GPO_DYEINGH_SSR5_CTRL F2_GPO_DYEINGH_SSR6_CTRL F2_GPO_DYEINGH_SSR7_CTRL F2_GPO_DYEINGH_SSR8_CTRL F2_GPO_CHILLER_SSR9_CTRL F2_GPO_SPARE_SSR12_CTRL F2_GPO_SPARE_SSR13_CTRL
+string[] F2_CTRL_Bits = {"F2_GPO_SPARE_SSR13_CTRL", "F2_GPO_SPARE_SSR12_CTRL", "F2_GPO_CHILLER_SSR9_CTRL", "F2_GPO_DYEINGH_SSR8_CTRL", "F2_GPO_DYEINGH_SSR7_CTRL", "F2_GPO_DYEINGH_SSR6_CTRL", "F2_GPO_DYEINGH_SSR5_CTRL", "F2_GPO_MIXCHIP_SSR4_CTRL", "F2_GPO_DRYER_SSR3_CTRL", "F2_GPO_DRYER_SSR2_CTRL", "F2_GPO_DRYER_SSR1_CTRL", "F2_GPO_PDOWN_RL1_CTRL", "rsv", "rsv", "rsv", "rsv"};
+
+const Int32 F1_gpo_01 = 0x3D2;//Miscellaneous output register, 16bits rsv rsv rsv rsv rsv rsv rsv rsv F1_VALVE_MIXCHIP_WASTECH F1_VALVE_WASTE_TANK F1_GPO_EXTWINDER_1 F1_GPO_EXTWINDER_2 F1_GPO_EXTWINDER_3 F1_GPO_DILUTORPUMP_SSR10_CTRL F1_GPO_WHS_WTANKPUMP2 F1_GPO_WASTECH_PUMP2
+const Int32 F3_GPO_01_bus = 0x0C2; //Writes to values. Readback thevaluessthat are currently in the GPO registerrsv rsv rsv rsv rsv rsv rsv rsv F3_SPARE1_ROTENC_CLK F3_SPARE2_ROTENC_CLK F3_GPO_BUZZER F3_GPO_EXTWINDER_SSR11_CTRL F3_GPO_LED1 F3_GPO_LED2 F3_GPO_LED3 F3_GPO_LED4
+
+const Int32 F2_Watchdog_reg = 0x140;
diff --git a/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_Tacho.cs b/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_Tacho.cs
new file mode 100644
index 000000000..1cd0008eb
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Defines/Tango_Defines_Tacho.cs
@@ -0,0 +1,45 @@
+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 F1_Tacho_reg0 = 0x3C0 ;
+const Int32 F1_Tacho_reg1 = 0x3C2 ;
+const Int32 F1_Tacho_reg2 = 0x3C4 ;
+const Int32 F1_Tacho_reg3 = 0x3C6 ;
+const Int32 F1_Tacho_reg4 = 0x3C8 ;
+const Int32 F1_Tacho_reg5 = 0x3CA ;
+const Int32 F1_Tacho_reg6 = 0x3CC ;
+const Int32 F1_Tacho_reg7 = 0x3CE ;
+const Int32 F2_Tacho_reg0 = 0x3C0 ;
+
+const Int32 F1_Prescaler1_reg5 = 0x3E8 ; // Parameter for prescaler divisions -amount of prescaled clocks for counter of signal All Tachos. rsv rsv rsv rsv rsv rsv rsv rsv parambit7 parambit6 parambit5 parambit4 parambit3 parambit2 parambit1 parambit0
+const Int32 F2_Prescaler1_reg10 = 0x102 ; // Variable for prescaler divisions -amount of prescaled clocks for counter of signal Blower Tacho. 8 bits parambit15 parambit14 parambit13 parambit12 parambit11 parambit10 parambit9 parambit8 parambit7 parambit6 parambit5 parambit4 parambit3 parambit2 parambit1 parambit0
+
+const Int32 F2_Prescaler1_reg7 = 0x3EC ; // Parameter for prescaler divisions - 16bit BLOWER low duty cycle value for pmw, parambit15 ... parambit0
+const Int32 F2_Prescaler1_reg8 = 0x3EE ; // Parameter for prescaler divisions - 16bit BLOWER high duty cycle value for pmw. parambit15 ... parambit0
+const Int32 F2_Prescaler1_reg11 = 0x112 ; // Variable for prescaler divisions -amount of prescaled clocks clk input of pwm of signal F2_GPO_BLOWER_PWM. 16bits. parambit15 ... parambit0
+const Int32 F2_Prescaler1_reg12 = 0x122 ;
+const Int32 F2_Prescaler1_reg13 = 0x132 ;
+
+
+const Int32 F3_Prescaler1_reg9 = 0x3c2 ;
+
+const Int32 F1_Prescaler1_reg1 = 0x3E0 ;
+const Int32 F1_Prescaler1_reg2 = 0x3E2 ;
+const Int32 F1_Prescaler1_reg3 = 0x3E4 ;
+const Int32 F1_Prescaler1_reg4 = 0x3E6 ;
+const Int32 F1_Prescaler1_reg6 = 0x3EA ;
+const Int32 F1_Prescaler1_reg7 = 0x3EC ;
+const Int32 F1_Prescaler1_reg8 = 0x3EE ;
+
+
diff --git a/Software/Stubs Collection/stubs/Scripts/Read_Version.cs b/Software/Stubs Collection/stubs/Scripts/Read_Version.cs
new file mode 100644
index 000000000..b3e3e2c1f
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/Read_Version.cs
@@ -0,0 +1,110 @@
+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 "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\LAB_Tests\Main_PCB\ATP_Test\Scripts\Defines\Tango_Defines_Basic.cs"
+
+int ReadFPGATestReg (Int32 Fpga)
+{
+ stubManager.Write("\nTest register, write 0xCAFE, expects 0x3501: ");
+ Fpga_Write_Reg(Fpga, TEST_REG, 0xcafe, 0);
+ var rv = Fpga_Read_Reg(Fpga, TEST_REG, 0);
+ stubManager.WriteHex(rv.Value,4);
+ return 1;
+}
+
+int ReadFPGAVer(Int32 Fpga)
+{
+
+ var response = Fpga_Read_Reg(Fpga, VER1_REG, 0);
+ stubManager.Write("\nVersion #ddmm: ");
+
+ stubManager.WriteHex(response.Value,4);
+ response.Value = 0;
+
+ response = Fpga_Read_Reg(Fpga, VER2_REG, 0);
+ stubManager.Write("\nVersion #yyvv: ");
+ stubManager.WriteHex(response.Value,4);
+ response.Value = 0;
+
+ return 1;
+
+}
+
+//private const string FILE_PATH = "D:\\logFile.txt";
+
+public void OnExecute(StubManager stubManager)
+{
+
+
+ //Invoke the response window with custom message and default response.
+ var response = stubManager.ShowResponseWindow("Enter Card serial number:", "UM187000xy");
+ stubManager.WriteLine(response);
+ stubManager.Write("\n");
+
+
+ var response_swid = stubManager.Run<StubReadEmbeddedVersionResponse>("StubReadEmbeddedVersionRequest" , true);
+ stubManager.Write("\nTIVA MCU SW Version (Major, Minor, Patch, Build, Version String): (");
+ stubManager.WriteHex(response_swid.VerMajor,4);
+ stubManager.Write(", ");
+ stubManager.WriteHex(response_swid.VerMinor,4);
+ stubManager.Write(", ");
+ stubManager.WriteHex(response_swid.VerPatch,4);
+ stubManager.Write(", ");
+ stubManager.WriteHex(response_swid.VerBuild,4);
+ stubManager.Write(", ");
+ stubManager.Write(response_swid.Version);
+ stubManager.Write(")\n");
+
+
+ //F1 Version and test register
+ stubManager.Write("\nFPGA_1");
+ ReadFPGAVer(FPGA1);
+ //ReadFPGATestReg(FPGA1);
+ stubManager.Write("\n");
+
+ //F2 Version and test register
+ stubManager.Write("\nFPGA_2");
+ ReadFPGAVer(FPGA2);
+ //ReadFPGATestReg(FPGA2);
+ stubManager.Write("\n");
+
+ //F3 Version and test register
+ stubManager.Write("\nFPGA_3");
+ ReadFPGAVer(FPGA3);
+ //ReadFPGATestReg(FPGA3);
+ stubManager.Write("\n");
+
+
+}
+
+/* Example Script Output
+TIVA MCU SW Version (Major, Minor, Patch, Build, Version String): (#0001, #0000, #0000, #0001, Tango01 May 16 2018 10:47:13)
+
+FPGA_1
+Version #ddmm: #0905
+Version #yyvv: #1801
+Test register, write 0xCAFE, expects 0x3501: #3501
+
+FPGA_2
+Version #ddmm: #1305
+Version #yyvv: #1801
+Test register, write 0xCAFE, expects 0x3501: #3501
+
+FPGA_3
+Version #ddmm: #0805
+Version #yyvv: #1802
+Test register, write 0xCAFE, expects 0x3501: #3501
+
+
+*/
diff --git a/Software/Stubs Collection/stubs/Scripts/read embedded version.cs b/Software/Stubs Collection/stubs/Scripts/read embedded version.cs
new file mode 100644
index 000000000..8990fc2cd
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/read embedded version.cs
@@ -0,0 +1,23 @@
+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;
+
+public void OnExecute(StubManager stubManager)
+{
+// Request ----
+// UInt32 : AnyNumber
+
+// Response ----
+// UInt32 : AnyNumberBack
+// String : Version
+ stubManager.Run<StubReadEmbeddedVersionResponse>("StubReadEmbeddedVersionRequest");
+}
+