Home Forums MPLAB XC8 Project Discussions ADC Files causing issue

This topic contains 1 reply, has 2 voices, and was last updated by  Bitahwa Bindu 1 week ago.

  • Author
  • #2958

    usman ashraf

    Dear Sir,

    Unable to run the project.Please check.





    You must be logged in to view attached files.
  • #2961

    Bitahwa Bindu

    Found few problems:

    1. 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.
    2. 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.
    3. 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.
    4. lastly change the void DelayFor18TCY (void)
    5.  to: void DelayFor18TCY (void)
      Delay10TCYx(20) ;

You must be logged in to reply to this topic.