Page 1 of 1

DS18B20 Data read error

Posted: Fri Dec 01, 2023 9:47 am
by celebriums
Please note that everyone warm greetings from Istanbul.

In Flowcode 9, I think there is a temperature reading error with DS18B20.
I created the attached software by making sample code.

I am using PIC16F1516 processor and DS18B20+, DS18B20 component is connected to Port C7 with one wire.

When 12 bit resolution is selected, it shows a constant value of -0,0625 on the screen. The value never changes.
When 11 Bit resolution is selected, it shows a constant value of -0,1 on the screen. The value never changes.
When 10 Bit resolution is selected, the display shows a constant value of -0,2. The value does not change at all.
When 9 Bit resolution is selected, it shows a constant value of -0,5 on the screen. The value does not change at all.nce parallel FETs have been chosen in this design, schematic and PCB export features will not work

Re: DS18B20 Data read error

Posted: Fri Dec 01, 2023 9:50 am
by celebriums
I can see the data coming and going.
I limited the temperature value on the LCD screen to 4 characters and repeat the reading process at 1 second intervals.
The counter I set up as Intterupt is working properly.
I selected the OSC setting as 0x78 and I use a 16Mhz internal oscillator.

DS18B20 is installed upside down in the picture, but this is not a mistake, it looks like that because I made a mistake in the PCB.

GND comes in Pin 1.
Data input and output on Pin 2,
Pin 3 is Vcc

and a 4.7V supply.

Re: DS18B20 Data read error

Posted: Fri Dec 01, 2023 10:55 am
by medelec35
Hello.
I have just tested a DS18B20 using your Project file on Flowcode v9.
The only difference target is set for 16F18877.
Temperature is displayed for me as expected.

Have you tried a 1 sec flash test?

Re: DS18B20 Data read error

Posted: Fri Dec 01, 2023 11:53 am
by celebriums
Yes Dear Martin

There's a 24 ms difference compared to the oscilloscope. Could it be this error?
and Im using OSCCON = 0x78;

Re: DS18B20 Data read error

Posted: Fri Dec 01, 2023 5:52 pm
by medelec35
I don't think that will be too much of an issue.
Have you tried checking continuity between the pins of the sensor and the microcontroller?
E.g + to +, - to - and signal.
Although you said you can see s data so that should be ok.