1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
|
using System;
using System.Text;
using System.IO;
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 int New_DyeHead_UNDER_TEST=47;
const Int32 MGNET_OPEN=0x420301;
const Int32 MGNET_EN=0x420280;
const Int32 MGNET_CLOSE=0x420300;
const Int32 MGNET_DIS=0x420200;
const Int32 ACTDIR_ON=0x460280;
const Int32 ACTDIR_OFF=0x460200;
const Int32 ACTIN_ON=0x460308;
const Int32 ACTOUT_ON=0x460304;
const Int32 ACTIN_OFF=0x46030C;
const Int32 ACTOUT_OFF=0x46030C;
const Int32 LS_FRONT=0X460110;
const Int32 LS_REAR=0X460120;
const Int32 LS_UPPER=0X460140;
const Int32 LS_SPARE=0X460180;
const Int32 ACTIN_EN=0X460101;
const Int32 ACTOUT_EN=0X460102;
string EEPROM_Header="Header_1 "; //16 characters
int Head_Mux_Channel_ID = 4; //Head MUX channel
//float [] DyeHeadTemp = new float[6] ;
string [,] Units_status_New_DyeHead = new string[New_DyeHead_UNDER_TEST,2] {
{"Pt100_Zone_1","Pass"}, //0
{"Pt100_Zone_2","Pass"}, //1
{"Pt100_Zone_3","Pass"}, //2
{"Pt100_Zone_4","Pass"}, //3
{"Pt100_Zone_5","Pass"}, //4
{"Pt100_Zone_6","Pass"}, //5
{"Pt100_Zone_7","Pass"}, //6
{"Pt100_Zone_8","Pass"}, //7
{"Pt100_Zone_9","Pass"}, //8
{"Pt100_Zone_10","Pass"}, //9
{"Pt100_Zone_11","Pass"}, //10
{"Pt100_Zone_12","Pass"}, //11
{"Current_Zone_1","Pass"}, //12
{"Current_Zone_2","Pass"}, //13
{"Current_Zone_3","Pass"}, //14
{"Current_Zone_4","Pass"}, //15
{"Current_Zone_5","Pass"}, //16
{"Current_Zone_6","Pass"}, //17
{"Current_Zone_7","Pass"}, //18
{"Current_Zone_8","Pass"}, //19
{"Current_Zone_9","Pass"}, //20
{"Current_Zone_10","Pass"}, //21
{"Current_Zone_11","Pass"}, //22
{"Current_Zone_12","Pass"}, //23
{"Break_Zone_1","Pass"}, //24
{"Break_Zone_2","Pass"}, //25
{"Break_Zone_3","Pass"}, //26
{"Break_Zone_4","Pass"}, //27
{"Break_Zone_5","Pass"}, //28
{"Break_Zone_6","Pass"}, //29
{"Break_Zone_7","Pass"}, //30
{"Break_Zone_8","Pass"}, //31
{"Break_Zone_9","Pass"}, //32
{"Break_Zone_10","Pass"}, //33
{"Break_Zone_11","Pass"}, //34
{"Break_Zone_12","Pass"}, //35
{"Magnet ","Not Test"}, //36
{"LS_REAR","Not Test"}, //37
{"LS_FRONT","Not Test"}, //38
{"DH_LID_Motor","Not Test"}, //39
{"EEPROM ","Pass"}, //40
{"ACTUATOR_IN","Not Test"}, //41
{"LS_IN_UP","Not Test"}, //42
{"LS_IN_DN","Not Test"}, //43
{"ACTUATOR_OUT","Not Test"}, //44
{"LS_OUT_UP","Not Test"}, //45
{"LS_OUT_DN","Not Test"}, //46
};
//--------------------------------------------------------------------------------
public Task<decimal> NewDyeHead_test( Action<string> settext, CancellationToken cancellationToken, string SN, string Location)
{
Task<decimal> task = null;
// Start a task and return it
task = Task.Run(() =>
{
stubManager.Write("S/N:" +SN+ "\n");
stubManager.Write("Location:" +Location+ "\n");
copy_table (New_DyeHead_UNDER_TEST,Units_status_New_DyeHead);
DialogResult result1 = MessageBox.Show("Make shure, Dyehead is not hot", "Warning",MessageBoxButtons.OKCancel);
if(result1 == DialogResult.Cancel)
{
stubManager.AppendToFile(File_Name1,"Dyehead is too hot \tFail");
stubManager.Write("Dyehead is too hot \tFail\n");
return 0 ;
}
else
{
//------------------------------- start test -----------
settext("Test Magnet Motor LS");
Test_Magnet_Motor_LS_New_DyeHead();
settext("Test heaters &pt100");
Test_heaters_pt100 ();
settext("Test Head EEPROM");
Test_Head_EEPROM(SN);
settext("Test Actuator In");
Test_Actuator_in();
settext("Test Actuator Out");
Test_Actuator_out();
Status=write_to_file(SN,Location,DyeHead_UNDER_TEST,"Dyehead");
settext("End Test");
}
decimal result = 0;
return result;
});
return task;
}
//-------------------------------------------------------------
int Test_Actuator_in()
{
Int32 temp;
int i=0;
DialogResult result = MessageBox.Show("Make shure, ACTUATOR-IN is down", "Warning",MessageBoxButtons.OKCancel);
if(result == DialogResult.Cancel)
{
Units_status[41,1]="Fail";
stubManager.Write("ACTUATOR-IN is Up\n");
return 0;
}
//---------------------- move ACTUATOR-IN Up ----------------------------
stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTDIR_ON); // DIR=1
stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTIN_ON); // act_in enable
delay(10);
stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTIN_OFF); // act_in disable
stubManager.Write("ACTUATOR-IN moving Up\n");
temp = 1;
i=0;
while ((temp != 0x0)&& (i<200) ) //wait until Limit Switch or timeout 200*50msec=10sec
{
temp=read_pio (ACTIN_EN); // read ACTIN_EN
delay(50);
i++;
}
if(i == 200)
{
Units_status[41,1]="Fail";
stubManager.Write("CTUATOR-IN is not moving Up\n");
return 0;
}
DialogResult result2 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.OKCancel);
if(result2 == DialogResult.Cancel)
{
Units_status[42,1]="Fail";
stubManager.Write("LS_IN_UP Not calibrate\n");
return 0;
}
Units_status[41,1]="Pass";
Units_status[42,1]="Pass";
//---------------------- move ACTUATOR-IN Dn ----------------------------
stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTDIR_OFF); // DIR=0
stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTIN_ON); // act_in enable
delay(10);
stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTIN_OFF); // act_in disable
stubManager.Write("ACTUATOR-IN moving Dn\n");
temp = 1;
i=0;
while ((temp != 0x0)&& (i<200) ) //wait until Limit Switch or timeout 200*50msec=10sec
{
temp=read_pio (ACTIN_EN); // read ACTIN_EN
delay(50);
i++;
}
if(i == 200)
{
Units_status[41,1]="Fail";
stubManager.Write("CTUATOR-IN is not moving Down\n");
return 0;
}
DialogResult result3 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.OKCancel);
if(result3 == DialogResult.Cancel)
{
Units_status[43,1]="Fail";
stubManager.Write("LS_IN_Down Not calibrate\n");
return 0;
}
Units_status[43,1]="Pass";
return 0;
}
//-------------------------------------------------------------
int Test_Actuator_out()
{
Int32 temp;
int i=0;
DialogResult result = MessageBox.Show("Make shure, ACTUATOR-OUT is down", "Warning",MessageBoxButtons.OKCancel);
if(result == DialogResult.Cancel)
{
Units_status[44,1]="Fail";
stubManager.Write("ACTUATOR-OUT is Up\n");
return 0;
}
//---------------------- move ACTUATOR-OUT Up ----------------------------
stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTDIR_ON); // DIR=1
stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTOUT_ON); // act_OUT enable
delay(10);
stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTOUT_OFF); // act_OUT disable
stubManager.Write("ACTUATOR-OUT moving Up\n");
temp = 1;
i=0;
while ((temp != 0x0)&& (i<200) ) //wait until Limit Switch or timeout 200*50msec=10sec
{
temp=read_pio (ACTOUT_EN); // read ACTOUT_EN
delay(50);
i++;
}
if(i == 200)
{
Units_status[44,1]="Fail";
stubManager.Write("CTUATOR-OUT is not moving Up\n");
return 0;
}
DialogResult result2 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.OKCancel);
if(result2 == DialogResult.Cancel)
{
Units_status[45,1]="Fail";
stubManager.Write("LS_OUT_UP Not calibrate\n");
return 0;
}
Units_status[44,1]="Pass";
Units_status[45,1]="Pass";
//---------------------- move ACTUATOR-OUT Dn ----------------------------
stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTDIR_OFF); // DIR=0
stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTOUT_ON); // act_out enable
delay(10);
stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTOUT_OFF); // act_out disable
stubManager.Write("ACTUATOR-OUT moving Dn\n");
temp = 1;
i=0;
while ((temp != 0x0)&& (i<200) ) //wait until Limit Switch or timeout 200*50msec=10sec
{
temp=read_pio (ACTOUT_EN); // read ACTOUT_EN
delay(50);
i++;
}
if(i == 200)
{
Units_status[44,1]="Fail";
stubManager.Write("CTUATOR-OUT is not moving Down\n");
return 0;
}
DialogResult result3 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.OKCancel);
if(result3 == DialogResult.Cancel)
{
Units_status[46,1]="Fail";
stubManager.Write("LS_OUT_Down Not calibrate\n");
return 0;
}
Units_status[46,1]="Pass";
return 0;
}
//--------------------------------------------
int Test_Magnet_Motor_LS_New_DyeHead()
{
Int32 temp;
int i=0;
//---------------------- open Magnet ----------------------------
stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,MGNET_OPEN); // turn magnet on
stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,MGNET_EN); // magnet enable
stubManager.Write("Magnet is Open\n");
delay(1000);
//---------------------- chekc Magnet is open ----------------------------
temp=read_pio (LS_UPPER); // read LS_UPPER
if (temp != 0)
{
Units_status[36,1]="Fail";
stubManager.Write("Magnet is close\n");
return 0;
}
DialogResult result = MessageBox.Show("Make shure, Magnet is open", "Warning",MessageBoxButtons.OKCancel);
if(result == DialogResult.Cancel)
{
Units_status[36,1]="Fail";
stubManager.Write("Magnet is close\n");
return 0;
}
//---------------------- Move DyeingHead Lid Motor rear----------------------------
stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,DyeingHeadLid_Motor, true, 250);
stubManager.Write("*** Open Lid Head \n");
temp = 0;
i=0;
while ((temp == 0x0)&& (i<200) ) //wait until Limit Switch or timeout 200*50msec=10sec
{
temp=read_pio (LS_REAR); // read LS_REAR
delay(50);
i++;
}
stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,DyeingHeadLid_Motor,3); //stop motor
if(i == 200)
{
Units_status[37,1]="Fail";
Units_status[39,1]="Fail";
stubManager.Write("LS_REAR Not calibrate\n");
return 0;
}
DialogResult result2 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.OKCancel);
if(result2 == DialogResult.Cancel)
{
Units_status[37,1]="Fail";
Units_status[39,1]="Fail";
stubManager.Write("LS_REAR Not calibrate\n");
return 0;
}
Units_status[37,1]="Pass";
//---------------------- Move DyeingHead Lid Motor front----------------------------
stubManager.Write("*** Close Lid Head \n");
stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,DyeingHeadLid_Motor, false, 250);
temp = 0;
i=0;
while ((temp == 0x0)&& (i<200) ) //wait until Limit Switch or timeout 200*50msec=10sec
{
temp=read_pio (LS_FRONT); // read LS_FRONT
delay(50);
i++;
}
stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,DyeingHeadLid_Motor,3); //stop motor
if(i == 200)
{
Units_status[38,1]="Fail";
stubManager.Write("LS_FRONT Not calibrate\n");
return 0;
}
DialogResult result3 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.OKCancel);
if(result3 == DialogResult.Cancel)
{
Units_status[38,1]="Fail";
stubManager.Write("LS_FRONT Not calibrate\n");
return 0;
}
Units_status[37,1]="Pass";
Units_status[38,1]="Pass";
//---------------------- Close Magnet ----------------------------
stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,MGNET_CLOSE); // turn magnet off
delay(2000);
stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,MGNET_DIS); // magnet Disable
stubManager.Write("Magnet is Close\n");
delay(1000);
//---------------------- chekc Magnet is close ----------------------------
temp=read_pio (LS_UPPER); // read LS_UPPER
if (temp == 0)
{
Units_status[36,1]="Fail";
stubManager.Write("Magnet is open\n");
return 0;
}
DialogResult result4 = MessageBox.Show("Make shure, Magnet is close", "Warning",MessageBoxButtons.OKCancel);
if(result4 == DialogResult.Cancel)
{
Units_status[36,1]="Fail";
stubManager.Write("Magnet is open\n");
return 0;
}
Units_status[36,1]="Pass";
stubManager.Write("Magnet is close\n");
return 0;
}
//------------------------------------
public int Test_new_heaters_pt100()
{
// uint utemp=0;
Int32 temp=0;
float ftemp=0;
float ftemp1=0;
float current=0;
Double current_sense;
for (Int32 i = 0; i < 12; i++)
{
Int32 tdly=10000;
//---------------------- get tempurature of heaters----------------------------
temp= 12+i/2+(i%2)*8; //HZone_1=12
//HZone_2=20
//HZone_3=13
//HZone_4=21
//HZone_5=14
//HZone_6=22
//HZone_7=15
//HZone_8=23
//HZone_9=16
//HZone_10=24
//HZone_11=17
//HZone_11=25
var response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" , temp); //get temperature from the buffer
ftemp = (float)response.TemperatureCMultBy100;
ftemp = ftemp / 100;
if ((ftemp>50)|| (ftemp<15))
{
Units_status[i,1]="Fail";
tdly=1000;
}
stubManager.Write("Zone-"+(i+1)+ "\t" + ftemp.ToString("F2")+"°C\n");
//---------------------- get current of heaters ----------------------------
var response1 = stubManager.Run<StubMidTankPressureSensorResponse>("StubMidTankPressureSensorRequest" ,0x8000 + i); // get current
current_sense=response1.Pressure;
if (current_sense>0.1)
{
Units_status[i+12,1]="Fail";
}
stubManager.Write("current is "+(i+1)+ "\t" + current_sense +"\n");
//---------------------- get Break of heaters ----------------------------
var response2 = stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,0x440000 +(i/8)*0x100+(1<<(i&7))); // read break
temp = (Int32) (response2.Progress);
if ((temp & (1<<(i&7))) !=0) //if break ok
{
Units_status[i+24,1]="Fail";
stubManager.Write("Break Zone "+(i+1)+ "\t is Off\n");
}
else
{
stubManager.Write("Break Zone "+(i+1)+ "\t is Off\n");
}
//---------------------- turn heater on ----------------------------
stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,0x400200 +(i/8)*0x100+(1<<(i&7))); // turn heater on
stubManager.Write("Heater - "+(i+1)+ "\t is On\n");
delay(2000); //delay 20 second
//---------------------- get current of heaters ----------------------------
var response3 = stubManager.Run<StubMidTankPressureSensorResponse>("StubMidTankPressureSensorRequest" ,0x8000 + i); // get current
current_sense=response3.Pressure;
if ((current_sense<1.1) ||(current_sense>1.4) ) //if current not 1.25A
{
Units_status[i+12,1]="Fail";
}
stubManager.Write("current is "+(i+1)+ "\t" + current_sense +"\n");
//---------------------- get Break of heaters ----------------------------
var response4 = stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,0x440000 +(i/8)*0x100+(1<<(i&7))); // read break
temp = (Int32) (response4.Progress);
if ((temp & (1<<(i&7))) !=0) //if break ok
{
Units_status[i+24,1]="Fail";
stubManager.Write("Break Zone "+(i+1)+ "\t is Off\n");
}
else
{
stubManager.Write("Break Zone "+(i+1)+ "\t is On\n");
}
delay(tdly); //delay 20 second
temp= 12+i/2+(i%2)*8;
var response5 = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" , temp); //get temperature from the buffer
ftemp1 = (float)response5.TemperatureCMultBy100;
ftemp1 = ftemp1 / 100;
if (((ftemp1-ftemp)<5)|| ((ftemp1-ftemp)>35))
{
Units_status[i,1]="Fail";
}
stubManager.Write("Zone-"+(i+1)+ "after heating is \t" + ftemp1.ToString("F2")+"°C\n");
//---------------------- turn heater off ----------------------------
stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,0x400200 +(i/8)*0x100); // turn heater off
stubManager.Write("Heater - "+(i+1)+ "\t is Off\n");
}
return 0;
}
Int32 read_pio(Int32 i2c_input)
{
Int32 temp=0;
var response = stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,i2c_input); // read break
temp = (Int32) (response.Progress);
temp =temp & (i2c_input& 0xff); //if break ok
return temp;
}
//end mati
//enable_all_channel();
public int Test_Head_EEPROM(string s_n)
{
enable_channel(Head_Mux_Channel_ID); // Chanel 0-7 => Disp0enser 0-7
Write_EEPROM(0xA0,s_n);
delay(20); //Sleep for 5 milli. - must! otherwise read 0xff (See data sheet )
adc_set_for_read_ch(0xA0);
//Thread.Sleep(1); //Sleep for 10 milli.
Read_EEPROM(0xA0);
delay(20); //Sleep for 5 milli. - must! otherwise read 0xff (See data sheet )
return 0;
}
int enable_channel(int Channel_ID)
{
uint Const_temp = 0x01;
StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest();
stubI2CWriteBytesRequest.I2CId = I2C_ID3;
stubI2CWriteBytesRequest.SlaveAddress = TCA9548A_address;
Const_temp = Const_temp << Channel_ID;
stubI2CWriteBytesRequest.BytesTWrite.Add(Const_temp);
var response = stubManager.Run<StubI2CWriteBytesResponse>(stubI2CWriteBytesRequest);
return 1;
}
int Write_EEPROM (uint I2C_Slave_Add,string s_n )
{
StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest();
stubI2CWriteBytesRequest.I2CId = I2C_ID3;
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
//--------------------------------------------------------------
char[] characters = EEPROM_Header.ToCharArray();
for (int i=0;i<16;i++)
{
stubI2CWriteBytesRequest.BytesTWrite.Add(characters[i]); //add header
}
characters = s_n.ToCharArray();
for (int i=0;i<16;i++)
{
stubI2CWriteBytesRequest.BytesTWrite.Add(characters[i]); //add s/n
}
var response = stubManager.Run<StubI2CWriteBytesResponse>(stubI2CWriteBytesRequest);
return 1;
}
int Read_EEPROM(uint I2C_Slave_Add)
{
StubI2CReadBytesRequest stubI2CReadBytesRequest = new StubI2CReadBytesRequest();
stubI2CReadBytesRequest.I2CId = I2C_ID3;
stubI2CReadBytesRequest.SlaveAddress = I2C_Slave_Add + 1;
stubI2CReadBytesRequest.NumberOfBytesToRead = 16; // Number of header bytes to read
var response1 = stubManager.Run<StubI2CReadBytesResponse>(stubI2CReadBytesRequest);
uint temph=0;
char[] characters = EEPROM_Header.ToCharArray();
for(int i=0; i<stubI2CReadBytesRequest.NumberOfBytesToRead;i++)
{
if (characters[i]!=response1.ReadBytes[i]);
Units_status[40,1]="Fail";
}
stubManager.Write("EEprom "+ Units_status[40,1]+"\n");
return 1;
}
|