- 13/03/2018 at 00:58 #2958
- 13/03/2018 at 16:09 #2961
Found few problems:
- The main problem is your circuit diagram: You didn’t connect Data D5 pin of the LCD. In 4bits mode, you must use D4, D5, D6 and D7. Move the line connected to D4 to D5 and the line connected to D3 to D4.
- To create a delay of 1 second, you must loop 20 times a delay of 50ms (1 000ms =20*50) and not 20 times 100ms, this will give you a delay of 2 Seconds but at the same time give you an error of too large argument in the delay, so always use a small delay number and increase the loop number to achieve the required delay when using the old compiler. This bug has been fixed in latest XC8 compilers, now you can use a large delay directly without looping.
- Change: voltage = (ADCResult*5)/1024; to voltage = (ADCResult*5.0)/1024; Don’t multiply by 5, this will be give you an integer voltage, all the decimal point will be rounded of, multiply by 5.0 this will tell the compiler that this is a decimal calculation.
- lastly change the void DelayFor18TCY (void)
- to: void DelayFor18TCY (void)
You must be logged in to reply to this topic.