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
| sbit LCD_RS at LATB4_bit;
sbit LCD_EN at LATB5_bit;
sbit LCD_D4 at LATB0_bit;
sbit LCD_D5 at LATB1_bit;
sbit LCD_D6 at LATB2_bit;
sbit LCD_D7 at LATB3_bit;
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
char txt1[5],v[5],txt2[5] ;
unsigned int a1,i,j,b1,k,c1,val;
void main()
{
ANSELA = 0xFF; // Configure PORT A pin as analog i/p
ANSELB = 0x00;
ANSELC = 0XFF; // Configure PORT C pin as analog i/p
ANSELD = 0xFF;
C1ON_bit = 0; // Disable comparators
C2ON_bit = 0;
TRISA = 0xFF; // PORTA is input
TRISB = 0x00;
TRISC = 0XFF; // PORTA is input
TRISD = 0xFF; // PORTD is i/p
Lcd_Init(); // Initialize Lcd
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
while(1)
{
Lcd_Cmd(_LCD_CLEAR);
for(i=0;i<8;i++)
{
/*for(j=0;j<8 ;j++)
{*/
a1 = ADC_read(i);
//EEPROM_Write(j,a1);
//jj=j+1;
EEPROM_Write(i,a1);
Delay_ms(1000);
}
for(i=0;i<8;i++)
{
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF);
val=EEPROM_Read(i);
Delay_ms(1000);
//LATD=val;
floatTostr(val,v);
Lcd_Out(1,1,v);
Delay_ms(1000);
}
Lcd_Cmd(_LCD_CLEAR);
for(j=14;j<20;j++)
{
/*for(j=0;j<8 ;j++)
{*/
jj = ADC_read(j);
//EEPROM_Write(j,a1);
//jj=j+1;
EEPROM_Write(j,b1);
Delay_ms(1000);
}
for(j=14;j<20;j++)
{
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF);
val=EEPROM_Read(j);
Delay_ms(1000);
//latd=val;
floatTostr(val,txt1);
Lcd_Out(2,1,txt1);
Delay_ms(1000);
}
Lcd_Cmd(_LCD_CLEAR);
for(k=20;k<27;k++)
{
/*for(j=0;j<8 ;j++)
{*/
c1 = ADC_read(k);
//EEPROM_Write(j,a1);
//jj=j+1;
EEPROM_Write(k,c1);
Delay_ms(1000);
}
for(k=20;k<27;k++)
{
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF);
val=EEPROM_Read(k);
Delay_ms(1000);
//latd=val;
floatTostr(val,txt2);
Lcd_Out(2,6,txt2);
Delay_ms(1000);
}
}
} |