code
int Read_T(void);
main()
{
TRISB = 0xF0;
CMCON = 0x07;
PORTB.F0=0;
while(1)
{
if(Read_T()<20)
{
PORTB.F0=1;
}
if(Read_T()>30)
{
PORTB.F0;
}
}
}
int Read_T(void)
{
int i;
i =0;
TRISA = 0xF0;
PORTA.F0 = 1;
Delay_ms(10);
TRISA = 0xF1;
while(PORTA.F
{
i++;
}
i = i/10;
return i ;
}
No comments:
Post a Comment