ADC in C language???

Discussion in 'Programmer's Corner' started by JK-FlipFlop, Aug 14, 2010.

  1. JK-FlipFlop

    Thread Starter Member

    Jul 5, 2010
    111
    0
    Last edited: Aug 15, 2010
  2. JK-FlipFlop

    Thread Starter Member

    Jul 5, 2010
    111
    0
    ............................................................
     
    Last edited: Aug 15, 2010
  3. CVMichael

    Senior Member

    Aug 3, 2007
    416
    17
  4. JK-FlipFlop

    Thread Starter Member

    Jul 5, 2010
    111
    0
    ............................................................
     
    Last edited: Aug 15, 2010
  5. CVMichael

    Senior Member

    Aug 3, 2007
    416
    17
    OK, what compiler are you using ?

    There are quite a few, and each one has a different way to read the ADC.

    For example I use mikroC, and the code would be:
    Code ( (Unknown Language)):
    1.  
    2. int adc0;
    3.  
    4. adc0 = ADC_Read(0);
    5.  
     
  6. JK-FlipFlop

    Thread Starter Member

    Jul 5, 2010
    111
    0
    I am using MPLab and an hi-Tech compiler.
     
  7. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    Your question about converting to a number suggests you might get some insight from our Ebook about A to D conversion - http://www.allaboutcircuits.com/vol_4/chpt_13/5.html

    Briefly, the ADC's output is a number that represents the magnitude of the applied voltage.
     
  8. JK-FlipFlop

    Thread Starter Member

    Jul 5, 2010
    111
    0
    The info didnt help me to uild a surce code.....

    Does anyone here knows how to convert analog to digital in C lang on PIC18f4520 20Mhz???????????????????????????????????????????????????????????????????
     
  9. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    It is none functions in HI-Tech C doing the job for you. Read the data sheet. Find out about which register you have to write to in order to to preform an ADC. Write your code. If you still have problems post your code here. I have a nice code example but your somewhat importunate behavior made me forget the link.
     
  10. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234

    Sure, I know how to do that, will you pay me to do your work for you?????????????????????????????????????????????????????????????????

    Or can you be less rude in asking for help, remember you are the one who wants something so ask with a little more politeness and possibly show what work you have accomplished then you can be guided from there..... but no one is just going to do all the work for you....
     
  11. JK-FlipFlop

    Thread Starter Member

    Jul 5, 2010
    111
    0
    so it seems that you don't know how to do that..

    ..
    but I learned how to do that....
    thanks for nothing.....
     
  12. CVMichael

    Senior Member

    Aug 3, 2007
    416
    17
    LOL... you area talking as if it's our duty to help you. We are not paid to help you or anyone else.

    And if you DID pay for your hi-Tech compiler, then you know what, make your demands from them, not us.

    Otherwise, ask nicely if you want help from us, and show some effort!
     
  13. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234

    Wow, you can accomplish something besides deleting your posts..... next time leave the questions you posted so others can benefit from the results if any.... Doing what you did just shows how shallow and selfish you are.... You are going on my ignore list just like the rest of the idiots already on it.....

    B. Morse
     
    JK-FlipFlop likes this.
  14. Papabravo

    Expert

    Feb 24, 2006
    10,142
    1,790
    Good enough for me. He's on my ignore list as well. The wages of rudeness are ostracism.
     
Loading...