

Having a USB port that supplies enough power or using a good USB cable often fixes this problem. It might also help replacing the USB cable with a better or shorter one. Try to plug it to a USB hub powered by an external power source. Sometimes powering the ESP32, ESP8266, Arduino or similar boards directly from a PC USB port is not enough. If you’re powering the sensor from a 3.3V pin, in some cases powering the DHT with 5V solves the problem.

The DHT sensor has an operating range of 3V to 5.5V (DHT11) or 3V to 6V (DHT22). After checking and testing that your circuit is properly connected, if it still doesn’t work, continue reading the next troubleshooting tips. When you’re building an electronics project, you need to double-check the wiring or pin assignment. After that different parameters of the serial port are being configured e-g the SPFRG register which is responsible for the baudrate generation for the UART.Try one of the next troubleshooting tips. _XTAL_FREQ is basically the crystal frequency ( PLL output is 40MHz, which is the CPU frequency). In this function a baudrate of 9600 bps is defined (which you can easily change by changing the value from 9600 to any other number ). As we know that any PIC micro controller has an architecture which executes an instruction in 4 CPU cycles, hence this 10Mhz crystal + PLL makes this PIC run at 10MIPS (Million of instructions per second). The code for UART initialization is shown below. This crystal frequency is fed into PLL of PIC18F452, which boosts it to 40MHz. The following diagram shows the required circuit.Ī crystal of 10MHz is used with PIC18F452. Complete project code and the proteus simulation can be downloaded from the Downloads section at the bottom of this post. This post provides the UART code (compiled in MPLAB + HI-TECH C) for PIC18F452 (e-g to connect PIC18F452 controller with PC using serial adapter).


Pic18f4550 microcontroller based projects.Pic16f877a microcontroller based projects list.
