DS18B20 with PIC18F26K22
Posted: Wed Feb 27, 2019 10:12 am
Hello everyone,
I have a big problem with the operation of the DS18B20 and the PIC18F26K22. Usually I use a PIC 16F1829 with an OSCCON F0 configuration (32MHz) PLL enable and clock Flowcode at 32MHz and it works fine.
Now I changed Pic for reasons of use of additional inputs and outputs, but here it does not work.
I made a small program that includes a display, an LED, and DS18B20. I tried everything (at least it seems to me, in configuration).
First of all, and you will give me your opinion, according to this configuration: OSCCON 76 PLL enable and clock Flowcode to 64MHz (see program attached), the LED flashes but with a very very long time and then I display Error CRC.
other configuration: OSCCON 76 PLL Enable and Clock Flowcode 16 (16x4 = 64 MHz), the LED flashes, it seems to me, 1s, so everything seems normal, except that I display a temperature at 0 °.
I always display a T ° at 0 ° whatever the configuration of OSCCON (without changing the PLL and clock Flowcode).
Initially the entry DQ was on A5, I changed to C2 and I always display 0 °.
I tried OSCCON 0x76; 0x66; 0x72; 0x7c; 0x78; 0xf8 and I still do not display the temperature correctly.
Maybe there is a huge problem that I have not seen, but I think I will go crazy
Can you please help me
I have a big problem with the operation of the DS18B20 and the PIC18F26K22. Usually I use a PIC 16F1829 with an OSCCON F0 configuration (32MHz) PLL enable and clock Flowcode at 32MHz and it works fine.
Now I changed Pic for reasons of use of additional inputs and outputs, but here it does not work.
I made a small program that includes a display, an LED, and DS18B20. I tried everything (at least it seems to me, in configuration).
First of all, and you will give me your opinion, according to this configuration: OSCCON 76 PLL enable and clock Flowcode to 64MHz (see program attached), the LED flashes but with a very very long time and then I display Error CRC.
other configuration: OSCCON 76 PLL Enable and Clock Flowcode 16 (16x4 = 64 MHz), the LED flashes, it seems to me, 1s, so everything seems normal, except that I display a temperature at 0 °.
I always display a T ° at 0 ° whatever the configuration of OSCCON (without changing the PLL and clock Flowcode).
Initially the entry DQ was on A5, I changed to C2 and I always display 0 °.
I tried OSCCON 0x76; 0x66; 0x72; 0x7c; 0x78; 0xf8 and I still do not display the temperature correctly.
Maybe there is a huge problem that I have not seen, but I think I will go crazy
Can you please help me