This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

reading A/D value from the potentiometer

Dear Keil users,
I'm new here.
In BLINKY I want to do the following :

Write the A/D value read from the potentiometer and write it onto the LCD panel

Analogvalue 754

#include <stdio.h>
// after reading the analog value
set_cursor (0, 0);
sprintf(text1,"Analogwert %5d",AD_value);
lcd_print (text1);

But I don't know how to read the value from the potentiometer.Any suggestions?
Thanks for advance for any help.
Adel.

Parents
  • Is this whole forum full of people just taking the pi*s, getting people to spend good time replying to complete idiots?

    Listen Dodgey Dave ***,

    First of all you have to respect the terms of use in the forum and don't say to anyone an iodot.
    Second, this a public forum and all people could post their question regardless of their programming level. I don't see in this forum any rubric for low or advanced levels. And if you're not able to respond to questions let your comemnts in your home.
    So respect yourself next time.

Reply
  • Is this whole forum full of people just taking the pi*s, getting people to spend good time replying to complete idiots?

    Listen Dodgey Dave ***,

    First of all you have to respect the terms of use in the forum and don't say to anyone an iodot.
    Second, this a public forum and all people could post their question regardless of their programming level. I don't see in this forum any rubric for low or advanced levels. And if you're not able to respond to questions let your comemnts in your home.
    So respect yourself next time.

Children
  • So, have you performed the normal routine of eliminating possible error sources?

    Have you verified that the potentiometer can generate the full range of voltages that the ADC can measure?

    Have you verified that the ADC voltage reference is correct?

    Have you verified that the binary value you read from the ADC can take any value between 0 and 0x3ff, i.e. between 0 and 1023?

    Have you verified that your sprintf - if given a value of 1023 - will produce a correct text string?

    Have you verified that said string will be corerctly sent to the display?

    Performing these steps should give a good indication exactly what problem you have - and how/if you can fix it.