void main(void)
{
int i;
TRISBbits.TRISB7 = 0;
while(1){
PORTBbits.RB7=0;
//for(i=0;i<3;i++);
DS1820_DelayUs(3);
PORTBbits.RB7=1;
//for(i=0;i<3;i++);
DS1820_DelayUs(3);
}
}
void Delay(unsigned char a)
{
int i,j;
for(i = 0; i < a; i++)
for( j = 0; j < 3; j++);
}
void DS1820_DelayUs(int val)
{
int k;
for(k=0;k<val;k++);
}
/*******
Delay(1); 52usec LOW AND 52USEC HIGH
Delay(2); 88USEC LOW 88USEC HIGH
Delay(3); 125USEC LOW 125USEC HIGH
36 USEC INRCM FOR EACH SINGLE DELAY WITH FUNCTION CALLING TIME 16USEC
**********************************
PORTBbits.RB7=0;
i=7;
PORTBbits.RB7=1;
i=5; // 1.4usec low and 2.1usec high.
**********************************
for(i=0;i<1;i++); 13usec LOW AND 14USEC HIGH
for(i=0;i<2;i++); 19usec LOW AND 20USEC HIGH
for(i=0;i<3;i++); 26usec LOW AND 26USEC HIGH
EACH FOR LOOP COUNT IS 7USEC DELAY
**********************************
DS1820_DelayUs(1); 25usec low and 26usec high
DS1820_DelayUs(2); 35usec low and 36usec high
DS1820_DelayUs(3); 44usec low and 45usec high
******/