abdul991
Junior Member level 1
- Joined
- Feb 8, 2013
- Messages
- 16
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,402
I'm using mplab -pickit 2 for programing single Ds1820+PIC18f452+Hyperterminal. I'm new to this 1-wire concept.
The problem is i'm unable to receive the output-low presence pulse after i send reset pulse for more than 480usec to the ds1820
This is my code. Please help. i'm doing my engg. project
The problem is i'm unable to receive the output-low presence pulse after i send reset pulse for more than 480usec to the ds1820
This is my code. Please help. i'm doing my engg. project
Code:
while(1)
{
DS1820_DelayUs(10000);
serialSend1(resetTx());serial Transmit
}
bool input_func(void)
{
TRISBbits.TRISB3 = 1;
return PORTBbits.RB3;
}
bool resetTx()
{
bool bPresPulse;
TRISBbits.TRISB3 = 0;
PORTBbits.RB3 = 0
DS1820_DelayUs(500);
serialSendRst(input_func()); // serial Transmit
DS1820_DelayUs(40);
/* get presence pulse */
DS1820_DelayUs(100);
bPresPulse = input_func();
return bPresPulse;
}
// 12Mhz clock = > ( 1/12M)secs per clock cycle.
// 1 inst = 4 clock cycle = 4*1/12M = 0.333 usec
// 1usec delay = 1/.333 = 3
void DS1820_DelayUs(long delayUs)
{
int i,j;
for (i=0;i<delayUs;i++)
for (j=0;j<3;j++);
}