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
DS18B20 component not working on FC10?
-
- Posts: 121
- http://meble-kuchenne.info.pl
- Joined: Thu Oct 14, 2021 10:04 am
- Has thanked: 49 times
- Been thanked: 4 times
-
- 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?
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.
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
Re: DS18B20 component not working on FC10?
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.
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.
-
- 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?
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.
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
Re: DS18B20 component not working on FC10?
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.
¿Te puedo adjuntar, está noche, por aquí el fichero y me miras a ver qué estoy haciendo mal?
C.
Re: DS18B20 component not working on FC10?
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.
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
-
- 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?
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
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
Re: DS18B20 component not working on FC10?
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?
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?