aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Stubs Collection
diff options
context:
space:
mode:
authorAvi Levkovich <avi@twine-s.com>2019-06-05 17:04:12 +0300
committerAvi Levkovich <avi@twine-s.com>2019-06-05 17:04:12 +0300
commite492c9a98cacd523f257ceb21fdd463c9c4921da (patch)
tree47ad3e0e53379fe93802172cc0864fe6a7f5db05 /Software/Stubs Collection
parentf9567b74a6fa6db7b4203dac0f79ebb7555f1512 (diff)
downloadTango-e492c9a98cacd523f257ceb21fdd463c9c4921da.tar.gz
Tango-e492c9a98cacd523f257ceb21fdd463c9c4921da.zip
upload stubs
Diffstat (limited to 'Software/Stubs Collection')
-rw-r--r--Software/Stubs Collection/stubs/ADS1220_Internal_Temperature_Sensor_PT100.cs46
-rw-r--r--Software/Stubs Collection/stubs/Create File system on the drive.cs16
-rw-r--r--Software/Stubs Collection/stubs/DISPENSER_type_LS_status.cs75
-rw-r--r--Software/Stubs Collection/stubs/DyeHead_SSR_CURRENT_SENSE.cs259
-rw-r--r--Software/Stubs Collection/stubs/GPO_BLOWER_PWM_Precent_.cs22
-rw-r--r--Software/Stubs Collection/stubs/I2C_RW_Dispenser_EEPROM_AVI.cs134
-rw-r--r--Software/Stubs Collection/stubs/lubricant_valve_close100_open0.cs22
-rw-r--r--Software/Stubs Collection/stubs/read_winder_encoder.cs71
-rw-r--r--Software/Stubs Collection/stubs/reset motor drivers.cs26
9 files changed, 671 insertions, 0 deletions
diff --git a/Software/Stubs Collection/stubs/ADS1220_Internal_Temperature_Sensor_PT100.cs b/Software/Stubs Collection/stubs/ADS1220_Internal_Temperature_Sensor_PT100.cs
new file mode 100644
index 000000000..6c9d3de2b
--- /dev/null
+++ b/Software/Stubs Collection/stubs/ADS1220_Internal_Temperature_Sensor_PT100.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;
+
+public void OnExecute(StubManager stubManager)
+{
+
+
+ //need embedded version > 20-02-2019
+
+
+
+ //MIXCHIP_TEMP = 0
+ //DYEINGH_TEMP1 = 1
+ //DYEINGH_TEMP2 = 2
+ //DYEINGH_TEMP3 = 3
+ //DYEINGH_TEMP4 = 4
+ //DYEINGH_TEMP5 = 5
+ //DRYER_TEMP1 = 6
+ //DRYER_TEMP2 = 7
+ //DRYER_TEMP3 = 8
+ //AN_ENCLOSURETEMP1 = 9
+ //AN_ENCLOSURETEMP2 = 10
+ //AN_ENCLOSURETEMP3 = 11
+
+ const Int32 Sensor = 2 ;//0-11
+
+ //Pay attention - We are changing the ADS setup - it will be updated only after the second call. - So run the stub twice !!!!!!!!!!!!!!!
+
+ var response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,0x100 | Sensor );
+
+ stubManager.WriteLine("ADS120 - Internal Temperature Sensor: ");
+
+ stubManager.Write(response.TemperatureCMultBy100);
+
+ stubManager.Write(" °C \t");
+
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Create File system on the drive.cs b/Software/Stubs Collection/stubs/Create File system on the drive.cs
new file mode 100644
index 000000000..67fd6c957
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Create File system on the drive.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;
+
+public void OnExecute(StubManager stubManager)
+{
+ var response = stubManager.Run<ProgressResponse>("ProgressRequest" ,0xCF, 0xCF);//Create File system on the drive
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/DISPENSER_type_LS_status.cs b/Software/Stubs Collection/stubs/DISPENSER_type_LS_status.cs
new file mode 100644
index 000000000..50aab3a20
--- /dev/null
+++ b/Software/Stubs Collection/stubs/DISPENSER_type_LS_status.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Text;
+using System.Linq;
+using System.Drawing;
+using System.Diagnostics;
+using System.Windows.Forms;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Collections.Generic;
+using Tango.PMR.Stubs;
+using Tango.Stubs;
+
+uint i = 0;
+
+public void OnExecute(StubManager stubManager)
+{
+
+
+
+ for(i=0;i<8;i++)
+ {
+
+ var response = stubManager.Run<ProgressResponse>("ProgressRequest" ,0xDE, i);//0XDE ispenser type + status, dispenser ID 0..7
+
+ stubManager.WriteLine(i);
+
+ if(response.Progress == 0x0100)
+ {
+ stubManager.WriteLine("DISP_TYPE_WITHOUT_EEPROM - status OK");
+ }
+ else if(response.Progress == 0x0101)
+ {
+ stubManager.WriteLine("DISP_TYPE_WITHOUT_EEPROM - status ERROR");
+ }
+ else if(response.Progress == 0x0200)
+ {
+ stubManager.WriteLine("DISP_TYPE_EEPROM32KB - status OK");
+ }
+ else if(response.Progress == 0x0201)
+ {
+ stubManager.WriteLine("DISP_TYPE_EEPROM32KB - status ERROR");
+ }
+ else if(response.Progress == 0x0300)
+ {
+ stubManager.WriteLine("DISP_TYPE_EEPROM128KB - status OK");
+ }
+ else if(response.Progress == 0x0301)
+ {
+ stubManager.WriteLine("DISP_TYPE_EEPROM128KB - status ERROR");
+ }
+ else
+ {
+ stubManager.WriteLineHex(response.Progress,2);
+ }
+ //stubManager.WriteLine("");
+
+ /*
+
+ if((request->amount == 0xDE) && (request->delay < 8) && (request->delay >= 0)) // read dispenser type + LS status
+ {
+ response.progress = ((Dispenser_struct[request->delay].Type) << 8) + Dispenser_struct[request->delay].Status;
+ response.has_progress = true;
+ }
+ else
+
+ //LS_STATUS_OK = 0,
+ //LS_STATUS_ERROR = 1,
+
+ DISP_TYPE_UNKNOWN = 0,
+ DISP_TYPE_WITHOUT_EEPROM = 1,
+ DISP_TYPE_EEPROM32KB = 2,
+ DISP_TYPE_EEPROM128KB = 3,
+ */
+ }
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/DyeHead_SSR_CURRENT_SENSE.cs b/Software/Stubs Collection/stubs/DyeHead_SSR_CURRENT_SENSE.cs
new file mode 100644
index 000000000..07fb27419
--- /dev/null
+++ b/Software/Stubs Collection/stubs/DyeHead_SSR_CURRENT_SENSE.cs
@@ -0,0 +1,259 @@
+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"
+
+//----------------------
+const Int32 I2C_ID = 2;
+//const Int32 I2C_Slave_Add = 0x46; //must be 0x40, 0x44 or 0x46
+//----------------------
+
+
+public void OnExecute(StubManager stubManager)
+{
+
+
+ UInt32 temp=0;
+
+
+ stubManager.Write("\n");
+ adc_configuration(0x40,0x08); //a2d_address 0x40 channel 3
+ adc_set_for_read_ch(0x40);
+ adc_read_ch(0x40);
+ var response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,1); //
+ stubManager.WriteHex(response.TemperatureCMultBy100,4);
+ //Write GPO_DYEINGH_SSR1_CTRL SSR/SSR no. 8
+ SetBit (FPGA2, F2_CTRL, 3, 1);
+ stubManager.Write("\tTesting SSR no. 8\tHeadZone-1");
+ Thread.Sleep(10000);
+ adc_configuration(0x40,0x08); //a2d_address 0x40 channel 3
+ adc_set_for_read_ch(0x40);
+ adc_read_ch(0x40);
+ SetBit (FPGA2, F2_CTRL, 3, 0);
+ var response1 = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,1); //
+ stubManager.WriteHex(response1.TemperatureCMultBy100,4);
+
+
+ adc_configuration(0x40,0x10); //a2d_address 0x40 channel 4
+ adc_set_for_read_ch(0x40);
+ adc_read_ch(0x40);
+ stubManager.Write("\n");
+ response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,2); //
+ stubManager.WriteHex(response.TemperatureCMultBy100,4);
+ //Write GPO_DYEINGH_SSR1_CTRL SSR/SSR no. 7
+ SetBit (FPGA2, F2_CTRL, 4, 1);
+ stubManager.Write("\tTesting SSR no. 7\tHeadZone-2");
+ Thread.Sleep(10000);
+ adc_configuration(0x40,0x10); //a2d_address 0x40 channel 4
+ adc_set_for_read_ch(0x40);
+ adc_read_ch(0x40);
+ SetBit (FPGA2, F2_CTRL, 4, 0);
+ response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,2); //
+ stubManager.WriteHex(response.TemperatureCMultBy100,4);
+
+
+ adc_configuration(0x40,0x20); //a2d_address 0x40 channel 5
+ adc_set_for_read_ch(0x40);
+ adc_read_ch(0x40);
+ stubManager.Write("\n");
+ response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,3); //
+ stubManager.WriteHex(response.TemperatureCMultBy100,4);
+ //Write GPO_DYEINGH_SSR1_CTRL SSR/SSR no. 6
+ SetBit (FPGA2, F2_CTRL, 5, 1);
+ stubManager.Write("\tTesting SSR no. 6\tHeadZone-3");
+ Thread.Sleep(10000);
+ adc_configuration(0x40,0x20); //a2d_address 0x40 channel 5
+ adc_set_for_read_ch(0x40);
+ adc_read_ch(0x40);
+ SetBit (FPGA2, F2_CTRL, 5, 0);
+ response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,3); //
+ stubManager.WriteHex(response.TemperatureCMultBy100,4);
+
+
+ adc_configuration(0x44,0x1); //a2d_address 0x44 channel 0
+ adc_set_for_read_ch(0x44);
+ adc_read_ch(0x44);
+ stubManager.Write("\n");
+ response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,4); //
+ stubManager.WriteHex(response.TemperatureCMultBy100,4);
+ //Write GPO_DYEINGH_SSR1_CTRL SSR/SSR no. 5
+ SetBit (FPGA2, F2_CTRL, 6, 1);
+ stubManager.Write("\tTesting SSR no. 6\tHeadZone-4");
+ Thread.Sleep(10000);
+ adc_configuration(0x44,0x1); //a2d_address 0x44 channel 0
+ adc_set_for_read_ch(0x44);
+ adc_read_ch(0x44);
+ SetBit (FPGA2, F2_CTRL, 6, 0);
+ response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,4); //
+ stubManager.WriteHex(response.TemperatureCMultBy100,4);
+
+
+ adc_configuration(0x44,0x2); //a2d_address 0x44 channel 1
+ adc_set_for_read_ch(0x44);
+ adc_read_ch(0x44);
+ stubManager.Write("\n");
+ response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,5); //
+ stubManager.WriteHex(response.TemperatureCMultBy100,4);
+ //Write GPO_DYEINGH_SSR1_CTRL SSR/SSR no. 10
+ SetBit (FPGA1, F1_gpo_01, 2, 1);
+ stubManager.Write("\tTesting SSR no. 6\tHeadZone-5");
+ Thread.Sleep(10000);
+ adc_configuration(0x44,0x2); //a2d_address 0x44 channel 1
+ adc_set_for_read_ch(0x44);
+ adc_read_ch(0x44);
+ SetBit (FPGA1, F1_gpo_01, 2, 0);
+ response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,5); //
+ stubManager.WriteHex(response.TemperatureCMultBy100,4);
+
+
+ adc_configuration(0x44,0x2); //a2d_address 0x44 channel 1
+ adc_set_for_read_ch(0x44);
+ adc_read_ch(0x44);
+ stubManager.Write("\n");
+ response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,11); //
+ stubManager.WriteHex(response.TemperatureCMultBy100,4);
+ //Write GPO_DYEINGH_SSR1_CTRL SSR/SSR no. 11
+ SetBit (FPGA3, F3_GPO_01_bus, 4, 1);
+ stubManager.Write("\tTesting SSR no. 6\tHeadZone-6");
+ Thread.Sleep(10000);
+ adc_configuration(0x44,0x2); //a2d_address 0x44 channel 1
+ adc_set_for_read_ch(0x44);
+ adc_read_ch(0x44);
+ SetBit (FPGA3, F3_GPO_01_bus, 4, 0);
+ response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,11); //
+ stubManager.WriteHex(response.TemperatureCMultBy100,4);
+
+
+
+ adc_configuration(0x46,0x20); //a2d_address 0x46 channel 20
+ adc_set_for_read_ch(0x46);
+ adc_read_ch(0x46);
+ stubManager.Write("\n");
+ response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,0); //
+ stubManager.WriteHex(response.TemperatureCMultBy100,4);
+ //Write F2_GPO_MIXCHIP_SSR4_CTRL SSR/SSR no. 4
+ SetBit (FPGA2, F2_CTRL, 7, 1);
+ stubManager.Write("Testing SSR no. 4\tMIXCHIP ");
+ adc_configuration(0x46,0x20); //a2d_address 0x46 channel 20
+ adc_set_for_read_ch(0x46);
+ adc_read_ch(0x46);
+ Thread.Sleep(10000);
+ SetBit (FPGA2, F2_CTRL, 7, 0);
+ response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,0); //
+ stubManager.WriteHex(response.TemperatureCMultBy100,4);
+
+
+}
+
+//----------------------
+
+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;
+ }
+
+
diff --git a/Software/Stubs Collection/stubs/GPO_BLOWER_PWM_Precent_.cs b/Software/Stubs Collection/stubs/GPO_BLOWER_PWM_Precent_.cs
new file mode 100644
index 000000000..f17802815
--- /dev/null
+++ b/Software/Stubs Collection/stubs/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/I2C_RW_Dispenser_EEPROM_AVI.cs b/Software/Stubs Collection/stubs/I2C_RW_Dispenser_EEPROM_AVI.cs
new file mode 100644
index 000000000..8adb754e9
--- /dev/null
+++ b/Software/Stubs Collection/stubs/I2C_RW_Dispenser_EEPROM_AVI.cs
@@ -0,0 +1,134 @@
+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 = 4; //MCU_I2C4
+const Int32 TCA9548A_address = 0xE2;
+//const Int32 I2C_Slave_Add = 0xA0; // //eeprom address - 32kByte & 128kByte
+const Int32 I2C_Slave_Add = 0xA2; //eeprom address - only in the eeprom of 128kByte
+int Dispenser_ID = 0; //Software Dispensers 0..7, BP Dispensers 1..8
+//----------------------
+
+int enable_all_channel()
+{
+ StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest();
+ stubI2CWriteBytesRequest.I2CId = I2C_ID;
+ stubI2CWriteBytesRequest.SlaveAddress = TCA9548A_address;
+
+ stubI2CWriteBytesRequest.BytesTWrite.Add(0xff);//enable all 8 i2c channel
+
+ var response = stubManager.Run<StubI2CWriteBytesResponse>(stubI2CWriteBytesRequest);
+
+ return 1;
+}
+
+int enable_channel(int Channel_ID)
+{
+ uint Const_temp = 0x01;
+
+ StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest();
+ stubI2CWriteBytesRequest.I2CId = I2C_ID;
+ stubI2CWriteBytesRequest.SlaveAddress = TCA9548A_address;
+
+ Const_temp = Const_temp << Channel_ID;
+ stubI2CWriteBytesRequest.BytesTWrite.Add(Const_temp);//enable i2c channel 0 Dispenser 1
+
+ var response = stubManager.Run<StubI2CWriteBytesResponse>(stubI2CWriteBytesRequest);
+
+ return 1;
+}
+
+
+int adc_write(uint I2C_Slave_Add)
+{
+ StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest();
+ stubI2CWriteBytesRequest.I2CId = I2C_ID;
+ stubI2CWriteBytesRequest.SlaveAddress = I2C_Slave_Add;
+
+ UInt32 uInt32 = new UInt32();
+ stubI2CWriteBytesRequest.BytesTWrite.Add(0);//Byte 0 to write
+ stubI2CWriteBytesRequest.BytesTWrite.Add(0);//Byte 0 to write
+ //--------------------------------------------------------------
+ stubI2CWriteBytesRequest.BytesTWrite.Add(0x12);//Data 0 to write
+ stubI2CWriteBytesRequest.BytesTWrite.Add(0x34);//Data 1 to write
+ stubI2CWriteBytesRequest.BytesTWrite.Add(0x56);//Data 2 to write
+ stubI2CWriteBytesRequest.BytesTWrite.Add(0x78);//Data 3 to write
+ stubI2CWriteBytesRequest.BytesTWrite.Add(0x90);//Data 4 to write
+ stubI2CWriteBytesRequest.BytesTWrite.Add(0xAB);//Data 5 to write
+ stubI2CWriteBytesRequest.BytesTWrite.Add(0xCD);//Data 6 to write
+ stubI2CWriteBytesRequest.BytesTWrite.Add(0xEF);//Data 7 to write
+ stubI2CWriteBytesRequest.BytesTWrite.Add(0x01);//Data 8 to write
+ stubI2CWriteBytesRequest.BytesTWrite.Add(0x02);//Data 9 to write
+
+ 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(0);//Byte 0 to write
+ stubI2CWriteBytesRequest.BytesTWrite.Add(0);//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 + 1;
+ stubI2CReadBytesRequest.NumberOfBytesToRead = 10; // Number of bytes to read
+
+ var response1 = stubManager.Run<StubI2CReadBytesResponse>(stubI2CReadBytesRequest);
+ uint temph=0;
+
+ for(int i=0; i<stubI2CReadBytesRequest.NumberOfBytesToRead;i++)
+ {
+ temph=response1.ReadBytes[i];
+ stubManager.WriteHex(temph,2);
+ }
+
+ return 1;
+}
+
+
+public void OnExecute(StubManager stubManager)
+{
+
+ //enable_all_channel();
+ enable_channel(Dispenser_ID); // Chanel 0-7 => Disp0enser 0-7
+
+ for (int i = 0; i<100; i++)
+ {
+
+ adc_write(I2C_Slave_Add);
+ Thread.Sleep(5); //Sleep for 5 milli. - must! otherwise read 0xff (See data sheet )
+ stubManager.Write("\n#");
+ stubManager.Write(i);
+ stubManager.Write("\t- The Buffer is: ");
+ adc_set_for_read_ch(I2C_Slave_Add);
+ //Thread.Sleep(1); //Sleep for 10 milli.
+ adc_read_ch(I2C_Slave_Add);
+
+ Thread.Sleep(1000);
+
+ }
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/lubricant_valve_close100_open0.cs b/Software/Stubs Collection/stubs/lubricant_valve_close100_open0.cs
new file mode 100644
index 000000000..3559228e7
--- /dev/null
+++ b/Software/Stubs Collection/stubs/lubricant_valve_close100_open0.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 = 100;//0 - 100%
+
+
+ var response1 = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000800 | 0x39c, LOW+1);//Low 8 bit
+ var response2 = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000800 | 0x39e, 101 - LOW);//High 8 bit
+
+
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/read_winder_encoder.cs b/Software/Stubs Collection/stubs/read_winder_encoder.cs
new file mode 100644
index 000000000..a3a847791
--- /dev/null
+++ b/Software/Stubs Collection/stubs/read_winder_encoder.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;
+
+Int32 temp;
+
+Int32 counter = 0;
+
+UInt32 Direction = 0;
+
+Int32 Prev_counter = 0;
+
+public void OnExecute(StubManager stubManager)
+{
+
+while (true)
+
+ {
+// Request ----
+// UInt32 : Address
+
+// Response ----
+// UInt32 : Address
+// UInt32 : Value
+// String : Status
+// UInt32 : StatusWord
+var response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,0x60000100); //LSB
+ //stubManager.WriteLine(response.Value);
+var response1 = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,0x60000102); //MSB
+ //stubManager.WriteLine(response1.Value & 0x3FF );
+Direction = (response1.Value) & 0400;
+
+temp = ((Int32)(response1.Value) & 0x3FF);
+temp = temp << 16;
+
+temp = temp + (Int32)(response.Value);
+
+if((Prev_counter - temp > 10) || (temp - Prev_counter > 10))
+{
+ if(Direction != 0)
+ counter = counter - temp;
+ else
+ counter = counter + temp;
+
+}
+stubManager.WriteLine(temp);
+Prev_counter = temp;
+ //counter = counter + temp;
+//stubManager.WriteLine(counter);
+
+//stubManager.WriteLine(temp);
+
+ stubManager.Write("\n");
+
+ Thread.Sleep(1000);
+
+
+
+ }
+
+}
+
+
diff --git a/Software/Stubs Collection/stubs/reset motor drivers.cs b/Software/Stubs Collection/stubs/reset motor drivers.cs
new file mode 100644
index 000000000..fb521ab72
--- /dev/null
+++ b/Software/Stubs Collection/stubs/reset motor drivers.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;
+
+public void OnExecute(StubManager stubManager)
+{
+// Request ----
+// UInt32 : Address
+// UInt32 : Value
+
+// Response ----
+// String : Status
+// UInt32 : StatusWord
+ var response = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000000 + 0x0B2, 0);
+ response = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000000 + 0x0C2, 0);
+ response = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000400 + 0x0B2, 0);
+ response = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000800 + 0x0B2, 0);
+} \ No newline at end of file