PICODETECTOR CIRCUIT SCHEMATIC
PICODETECTOR SOURCE CODE
#define MAXTRY 15 unsigned char ctr ; unsigned char previous ; unsigned char calibr ; unsigned char restarts ; unsigned char en ; void main()
{
unsigned char i ;
CMCON0 = 7 ;
ANSEL = 0 ;
TRISIO = 0 ;
GPIO = 0 ;
if(STATUS.NOT_TO)
{
restarts = 0 ;
calibr = 1 ;
}
if(restarts < 255) restarts++ ;
if((previous ^ ctr) > calibr)
{
GPIO.F0 = en ;
if(STATUS.NOT_TO == 0)
{
if(restarts < MAXTRY)
{
calibr <<= 1 ;
Delay_ms(5) ;
}
}
else
{
GPIO.F0 = 0 ;
}
}
previous = ctr ;
if(restarts > MAXTRY)
{
GPIO.F1 = 0 ;
en = 1 ;
}
else
{
GPIO.F1 = 1 ;
en = 0 ;
}
OPTION_REG = 0b11111001 ;
ctr = 0 ;
for(;;)
{
ctr++ ;
}
}
|
DOWNLOAD PICODETECTOR PROJECT
Includes :
No comments:
Post a Comment