DS18B20 component not working on FC10?

For general Flowcode discussion that does not belong in the other sections.
Carmelo
Posts: 121
http://meble-kuchenne.info.pl
Joined: Thu Oct 14, 2021 10:04 am
Has thanked: 49 times
Been thanked: 4 times

Flowcode v10 DS18B20 component not working on FC10?

Post by Carmelo »

I have almost completely copied the example from the wiki, referring to the configuration and use of the Ds18B20 sensor blocks and when I run the program, the value 999 always seems to flash on the 7-segment displays.

What could be the solution to this problem to be able to see the temperature read from the sensor?

I attach the example file
Attachments
Test.fcfx
(78.92 KiB) Downloaded 7 times

medelec35
Matrix Staff
Posts: 1913
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 619 times
Been thanked: 644 times

Re: DS18B20 component not working on FC10?

Post by medelec35 »

Hello.
With the way the XC8 compiler works, the minimum frequency for pic8 for DS18B20 is about 19MHz.
There are plenty of devices that have a 32MHz+ internal oscillator, 64MHz in the newer devices.
DS18D20 does work with v10, just not at the 8MHz speed you have got your microcontroller running at.
The lower frequencies does not allow the critical timing required for OneWire devices.
This does not apply to AVR devices like Uno since there is no divide by 4 clock rate, so will work on the Uno/Mega etc
I have shown the temperature sensor working here.
Therefore, I'm moving this topic from Bugs to General.
Martin

Carmelo
Posts: 121
Joined: Thu Oct 14, 2021 10:04 am
Has thanked: 49 times
Been thanked: 4 times

Re: DS18B20 component not working on FC10?

Post by Carmelo »

Thank you very much for the response.
I'll see how to change the frequency.

C.

medelec35
Matrix Staff
Posts: 1913
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 619 times
Been thanked: 644 times

Re: DS18B20 component not working on FC10?

Post by medelec35 »

You're welcome.
If you need further assistance, then we are here to help
Martin

Carmelo
Posts: 121
Joined: Thu Oct 14, 2021 10:04 am
Has thanked: 49 times
Been thanked: 4 times

Re: DS18B20 component not working on FC10?

Post by Carmelo »

Pues siento decir que me sigue sin funcionar.

Cambie el oscilador interno a uno externo de 20MHz y en el fichero adjuntado de test en el otro apartado de este foro, deshabilite el bloque de configuración del oscilador interno.

El resultado de funcionamiento sigue siendo el mismo: parpadeo constante de los 3 displays con el valor siempre fijo de 999.

El fichero tiene la misma configuración que el ejemplo de la wiki, excepto el uso de la uart que no la uso.
La multiplexación para ver los valores la cree yo mismo y funciona a la perfección. Si deshabilito el bloque de lectura y pongo un bloque de cálculo con un valor fijo, este valor se ve perfecto en los displays.

medelec35
Matrix Staff
Posts: 1913
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 619 times
Been thanked: 644 times

Re: DS18B20 component not working on FC10?

Post by medelec35 »

Hoy probé el DS18B20 para asegurarme y funcionó a 19,6608 MHz.
Puedes comprobarlo con un flasher de 1 s. Si la frecuencia es correcta, comprueba que la resistencia pullup esté entre 4,7 kΩ y 10 kΩ. También revisa las conexiones de los pines.


I tested the DS18B20 today just to make sure, and it worked for me at 19.6608MHz.
You can check with a 1s flasher. If frequency is correct.
Then check the pullup resistor is 4.7K to 10K. Also check the connections going to the pins.
Martin

Carmelo
Posts: 121
Joined: Thu Oct 14, 2021 10:04 am
Has thanked: 49 times
Been thanked: 4 times

Re: DS18B20 component not working on FC10?

Post by Carmelo »

Pues a mí no me marca nada más que 999 de forma intermitente.

¿Te puedo adjuntar, está noche, por aquí el fichero y me miras a ver qué estoy haciendo mal?

C.

Carmelo
Posts: 121
Joined: Thu Oct 14, 2021 10:04 am
Has thanked: 49 times
Been thanked: 4 times

Re: DS18B20 component not working on FC10?

Post by Carmelo »

Adjunto el fichero que me da el error de funcionamiento.
La lectura de los displays se ve de forma intermitente como dije en post anteriores.
Attachments
Test_DS18B20.fcfx
(78.07 KiB) Downloaded 9 times

medelec35
Matrix Staff
Posts: 1913
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 619 times
Been thanked: 644 times

Re: DS18B20 component not working on FC10?

Post by medelec35 »

Con el cristal de 19 MHz, quité el DS18B20 y la lectura fue la misma: 999. ¿Tienes un analizador lógico o un osciloscopio para probar el sensor, ya que podría estar defectuoso?
Puedes probar la conexión quitando el sensor y conectando el pin A0 a 0 V. La lectura debería ser entonces de 0,00000.


With the 19MHz crystal, I removed the DS18B20 and the reading was the same 999. Do you have a logic analyser or a scope you can test the sensor with as it could be faulty?
You can test connection by removing the sensor and connecting pin A0 to 0V. the reading should then be 0.00000
Martin

Carmelo
Posts: 121
Joined: Thu Oct 14, 2021 10:04 am
Has thanked: 49 times
Been thanked: 4 times

Re: DS18B20 component not working on FC10?

Post by Carmelo »

Gracias por la respuesta.
He realizado lo que me ha comentado. Efectivamente el sensor estaba mal.
Lo he cambiado por uno nuevo y ahora sí se ve la lectura con el valor correcto, pero.....
El valor sigue parpadeando.

Es decir, veo bien el valor pero de forma parpadeante, he intentado ver porque pero no lo localizo. ¿ Puedes ser por el bloque que hay delante del bloque de lectura que provoca una espera?

¿Como podria conseguir que la lectura fuera estable?

Post Reply