Hi Matrix Team,
I have some trouble getting the one-wire bus to work. I'm using the following hardware:
1 x PIC18F8722 TQFP 80
4 x DS18B20 Temp. Sensors
I'm using this setup ( see pics):
The first cable from the main controller to the sensor box is about 2 meters long the cable of the sensor is about 1.5 meters long so in total of 3.5 meter cable.
I can read succesfully 1 temperature sensor but thats not the problem,
If I use the busreset, scanbus and get device count it never does what Im expecting for example:
Example 1:
no cable and no sensor box are connected thus no sensor is connected. with my current program you should think that the busreset macro returns a value greater than zero because no device can be detect because there is nothing to be detected.
But it never does the variable onewire_Busreset is first initialised with a value of 255 so this I dont understand
The same is for get device count it always returns 0 if I connect two sensors its says 0 if I connect one sensors it says 0 so this I dont understand
With the one wire component not working properly its not possible to use the four temperature sensors, hope this problem can be solved.
If it helps I have the one wire bus connected to Port B at Pin 5
Regards Jordy
One-Wire Bus Problem
Moderator: Benj
- Jordy101091
- Posts: 519
- Joined: Sat Jan 08, 2011 4:02 pm
- Location: The Netherlands
- Has thanked: 25 times
- Been thanked: 188 times
- Contact:
-
- Posts: 258
- Joined: Wed Nov 29, 2006 6:32 pm
- Location: Finland
- Has thanked: 7 times
- Been thanked: 36 times
- Contact:
Re: One-Wire Bus Problem
Hi.
You have pull up resistor at the onewire pin?
The busreset returns value 1 if the bus don't get the precence pulse at the onewire device, so the value should be 0 -> precence ok, device detected or 1-> bus remains high, no precence pulse..
If I am right, the get device count needs first tha scanbus macro, and after that you can read the device count...
But at least in the Dspic version, seems that those functions don't work..
Can you get the temp data at one sensor, just ds1820 spesific commands Start conversion->Read device->Get temp?
Hmm... Maybe I should read the post before reply..
But it seems thet the same prtoblem exist at the Dspic version, I can read 1 sensor, but not with the scanbus etc. functions... So there seem to be something wrong with the scanbus function..
Maybe I'll try revert back to Flowcode4 component, if I just have some time...
Mika
You have pull up resistor at the onewire pin?
The busreset returns value 1 if the bus don't get the precence pulse at the onewire device, so the value should be 0 -> precence ok, device detected or 1-> bus remains high, no precence pulse..
If I am right, the get device count needs first tha scanbus macro, and after that you can read the device count...
But at least in the Dspic version, seems that those functions don't work..
Can you get the temp data at one sensor, just ds1820 spesific commands Start conversion->Read device->Get temp?
Hmm... Maybe I should read the post before reply..
But it seems thet the same prtoblem exist at the Dspic version, I can read 1 sensor, but not with the scanbus etc. functions... So there seem to be something wrong with the scanbus function..
Maybe I'll try revert back to Flowcode4 component, if I just have some time...
Mika