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
| ADCON1 = 0x00;
v = ADC_Read(2);
i = ADC_Read(3);
i = (i*4.89)/0.5;
v = ((v*4.89)/20)*121;
t = ADC_Read(1);
if (t > 250 ) { // (48 Degree C = 100 so 97-98 = 200 )
led = 1;
}
else {
led = 0;}
if(v!=vp || i!=ip )
Lcd_Cmd(_LCD_FIRST_ROW);
vp = v;
ip = i;
volt1=v/100;
current1=i/10;
kp=volt1*current1;
volt[0] = look(v/10000);
volt[1] = look((v/1000)%10);
volt[3] = look((v/100)%10);
Lcd_Out(1,1,"V = ");
Lcd_Out(1,5,volt);
Lcd_Out(1,9,"V");
t = t * 0.4887;
a = t%10;
lcd[2] = a + '0';
t = t/10;
a = t%10;
lcd[1] = a + '0';
t = t/10;
a = t%10;
lcd[0] = a + '0';
Lcd_out(1,12,lcd);
customchar(1,15);
Lcd_out(1,16,"C");
current[0] = look(i/1000);
current[2] = look((i/100)%10);
current[3] = look((i/10)%10);
Lcd_Out(2,1,"A = ");
Lcd_Out(2,5,current);
Lcd_Out(2,9,"A");
PWR[0]=look((kp/10000));
PWR[1]=look((kp/1000)%10);
PWR[3]=look((kp/100)%10);
PWR[4]=look((kp/10)%10);
Lcd_Out(2,11,PWR);
Lcd_Out(2,16,"W");
Delay_ms(250);
} while(1);
} |