Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problems with 18b20
22-05-2014, 06:59 AM,
#11
RE: problems with 18b20
The file to fix the wrong temperatures is working, but I'm having an other issue, I can't use other sensors when using a 18B20

(imagine pin 13 for an LDR and pin 14 for 18B20)
for example:

#define ONEWIREBUS 14
int val1;
void setup() {
}

void loop() {
TEMPERATURE t;

if (DS18B20.read(ONEWIREBUS, SKIPROM, RES12BIT, &t))
{
if (t.sign) CDC.printf("-");
CDC.printf("%d.%d°C \r", t.integer, t.fraction);
}
delay(1000);

val1 = analogRead(13);
CDC.printf("%d", val1);
delay(1000);

}

Compiling is working but seems that DS18B20.read is blocking the PIC nothing is happening Sad . Is there any other method to use this sensor, like val2 = analogRead(14) ... and then do some conversions ?

Any help or suggestion, I'm missing something ?

Thanks

Additional info:

Bootloader: v4.14_18f4550_X20MHz
IDE: x4-easy-rev999
18b20.c (fixed)
Reply
22-05-2014, 03:57 PM,
#12
RE: problems with 18b20
I think the problem comes from your choice #define ONEWIREBUS 14.
The DQ line is digital and not analog. Try a value 0 to 7 as a true digital line.
As soon as you introduce an analog pin as 13 (AN0) all the ANx pins become analog pins, therefore 14 (AN1). This is a Pinguino rule at least for the 18fx550.
Former you probably use only pin 14, then this pin was considered as digital.
For me your code with #define ONEWIREBUS 4 works except the CDC which is often difficult to open in Hyperterminal. Before this difficulty I reboot my PC/Win7.
Good luck
André
Reply
22-05-2014, 08:00 PM,
#13
RE: problems with 18b20
Thank you André Wink problem is solved.
Reply
30-05-2014, 09:24 AM,
#14
RE: problems with 18b20
Tested yesterday on my pic32mx250 with 3 sensors on the bus ! Works like a charm (at least o my pic32) will do a test on the 2550 somewhere in the week end.
Joël

(28-03-2014, 12:50 AM)brikker Wrote: OK, I got something working.
I added the already working CRC calculation at the DS18B20Read function, and a cycle to repeat the reading until CRC is found valid.
Next days I will try to use it with multiple sensors on the bus.
Luca
Reply
18-09-2014, 08:19 AM,
#15
RE: problems with 18b20
(30-03-2014, 04:36 PM)regis Wrote: Tell me once you've done all your tests and I will update the file.

I had the same problem with this sensor and solve it with this version of 18b20.c.
Regards.
Darby
Reply
18-09-2014, 08:29 AM, (This post was last modified: 18-09-2014, 03:09 PM by gtcbreizh.)
#16
RE: problems with 18b20
Hello Darby,
Is it the 18b20.c attached by brikker in post #5.
Otherwise would you attach yours ? Thanks.
André
Reply
18-09-2014, 06:03 PM,
#17
RE: problems with 18b20
(18-09-2014, 08:29 AM)gtcbreizh Wrote: Hello Darby,
Is it the 18b20.c attached by brikker in post #5.
Otherwise would you attach yours ? Thanks.
André

Hello André,
I'm using the 18b20.c attached in post #8, do you test it ?
Regards.
Darby
Reply
18-09-2014, 06:32 PM,
#18
RE: problems with 18b20
(18-09-2014, 06:03 PM)darby59 Wrote:
(18-09-2014, 08:29 AM)gtcbreizh Wrote: Hello Darby,
Is it the 18b20.c attached by brikker in post #5.
Otherwise would you attach yours ? Thanks.
André

Hello André,
I'm using the 18b20.c attached in post #8, do you test it ?
Regards.
Darby

I am sorry ! It was effectively post #8.
This file is in the libraries since 27th March 2014 and I successfully used several times.
André
Reply
08-03-2015, 11:20 PM, (This post was last modified: 08-03-2015, 11:34 PM by joel.)
#19
RE: problems with 18b20
HEllo all,

I finally ended in testing the file from post #8 on pinguino 2550. It doesn't work properly if you have more than 1 device on the bus and want to read them all.
I am even starting to doubt of myself about getting it working with several devices on the PIC32...
Will do a test as soon as i can put my hand on the PIC32

Edit:
Test done...It works really nice on P32...

so...what's wrong with the pic2550 ???

Joël
Reply
11-10-2015, 08:49 PM,
#20
RE: problems with 18b20
Hello all,
I had a little time to test the 1wire library with my Pinguino2550.
This time I tested the multiple sensors connection on same bus (3xDS18B20 and 1xDS18S20).
I really had problem to let it work but at the end the solution was to
disable interrupts on OneWireReset, OneWireReadBit , OneWireWriteBit functions.

The only thing which remain to fix, is the temperature calculation for the DS18S20.
Next step!
See the example code below:

Code:
       TEMPERATURE t;
       DS18B20.find(ONEWIREBUS);
       do {
           CDC.printf("Reading#: %d  ---- Num of available Roms:%d\r\n", w, numROMs);
           for (j=1; j<=numROMs; j++) {
               if (DS18B20.read(ONEWIREBUS, j, RES12BIT, &t)) {
               i = t.integer;
               f = t.fraction;
               CDC.printf("Device#%02d: %02X %02X %02X %02X %02X %02X %02X %02X ---- Temp: %02d.%02d C\r\n", j,
               DS18B20Rom[j][0], DS18B20Rom[j][1], DS18B20Rom[j][2], DS18B20Rom[j][3],
               DS18B20Rom[j][4], DS18B20Rom[j][5], DS18B20Rom[j][6], DS18B20Rom[j][7], i, f);  
           }                
       }
       CDC.printf(" \r\n");
       w++;
       delay(3000);
       } while(1);

and the output:

Code:
Device#01: 10 E9 51 46 00 00 00 F5 ---- Temp: 01.93 C
Device#02: 28 B8 03 C7 05 00 00 7C ---- Temp: 19.56 C
Device#03: 28 F6 A7 C7 05 00 00 36 ---- Temp: 19.87 C
Device#04: 28 B9 B8 C6 05 00 00 FB ---- Temp: 19.43 C

Reading#: 19  ---- Num of available Roms:4
Device#01: 10 E9 51 46 00 00 00 F5 ---- Temp: 01.93 C
Device#02: 28 B8 03 C7 05 00 00 7C ---- Temp: 19.50 C
Device#03: 28 F6 A7 C7 05 00 00 36 ---- Temp: 19.81 C
Device#04: 28 B9 B8 C6 05 00 00 FB ---- Temp: 19.43 C

Reading#: 20  ---- Num of available Roms:4
Device#01: 10 E9 51 46 00 00 00 F5 ---- Temp: 01.93 C
Device#02: 28 B8 03 C7 05 00 00 7C ---- Temp: 19.56 C
Device#03: 28 F6 A7 C7 05 00 00 36 ---- Temp: 19.81 C
Device#04: 28 B9 B8 C6 05 00 00 FB ---- Temp: 19.43 C

Reading#: 21  ---- Num of available Roms:4
Device#01: 10 E9 51 46 00 00 00 F5 ---- Temp: 01.93 C
Device#02: 28 B8 03 C7 05 00 00 7C ---- Temp: 19.56 C
Device#03: 28 F6 A7 C7 05 00 00 36 ---- Temp: 19.81 C
Device#04: 28 B9 B8 C6 05 00 00 FB ---- Temp: 19.43 C

It looks really nice now! Big Grin Big Grin 
Find the modified library attached
Thanks
Luca


Attached Files
.c   1wire.c (Size: 5.91 KB / Downloads: 1)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)