Impossible Temperature Sensor

Alright here's a good challenge for anyone good with microcontrollers. I'm not sure whether this is exactly more of a software problem or a hardware problem, but I've been stuck on it for days:

Currently I am trying to interface with a DS18B20 temperature sensor, using a pic16F684 micro-controller. I have listed the code I am using below, which is in C for the Hi-Tech picc-lite compiler. A schematic of the circuit I am using can be found at [link=http://www.rentron.com/images/ds18202.gif][/link]
I have added a green LED to determine whether or not the reset function worked, and everytime I get a solid light instead of a blinking one indicating that it worked properly.
Any help is greatly apprectiated, but please post relevant answers.
Thanks in advance,
Soldred

These are the two sub-routines, that I am currently using:
[code]delay (int time) //timer subroutine in micro-seconds (us)
{
TMR0 = 256-time;
OPTION = 0b10011000; //runs TMR0 with 1:1 prescaler
//start 240 us timer
T0IF = 0; //disable any current interrupt requests
while (T0IF == 0)
{RA5 = 1;} //wait for Timer0 to overflow(turn light on)
RA5 = 0; // turn off green light
}

reset() //reset sensor with pulse
{
TRISA0 = 0; // output
RA0 = 0; // pull line low
delay(240); // delay for 480 uS
delay(240);
RA0 = 1;
TRISA0 = 1; //input
delay(15);
while (RA0 = 1)
{RA5 = 1;} // Hold green light on
}[/code]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories