+ Reply to Thread
Results 1 to 7 of 7

Thread: ADC readout to Decimal

  1. #1
    Kryten Newbie
    Join Date
    Oct 2007
    Location
    Stavern, Norway
    Posts
    292

    Default ADC readout to Decimal

    Q1:
    Do anyone here hav a "quick" code for making the BCD readout from ADC into a decimal number (kind of like Vref = 50A ) so it calculates for it self what to put in stead of BCD.

    Q2: (In case anyone have a code)
    If i have several different levels at the ADC
    AN0: 5V = 50 A (enegry consumption)
    AN1: 5V = 25 A (energy charging)
    AN3: 5V = 14.4V (battery voltage)

    Is it possibel to say that Vref is xx to AN0, yy to AN1 and zz to AN3
    The best is yet to come

    Good enough - its perfect !!

    2 Gig of free online backup space

    cq cq de LA3BNA


  2. #2
    richard.c Okay
    Join Date
    May 2007
    Location
    England
    Posts
    155

    Default

    See the Piclist site for various converters

    http://www.piclist.com/techref/A2DCodeGenerator.asp

  3. #3
    Kryten Newbie
    Join Date
    Oct 2007
    Location
    Stavern, Norway
    Posts
    292

    Default

    Ok thats nice but i was thinknig of how to get the readout (either to LCD or MMC (using microC libs and compiler)) to dispaly that 5V on ADC = 50A and son on.
    The piclist site is great (althou it gives out asm code) but not what Im looking for
    The best is yet to come

    Good enough - its perfect !!

    2 Gig of free online backup space

    cq cq de LA3BNA

  4. #4
    superbrew Okay
    Join Date
    Oct 2007
    Location
    Nashua, NH
    Posts
    101

    Default

    Something like:
    Code:
    unsigned int input;
    char display[8];
    while(1){
         input = (adc_read(1)*50)/1023;
         inttostr(input,display);
         LCD_Out(display,0,0);
    }
    
    I am not at home so this is untested, but something like this will work.

  5. #5
    Kryten Newbie
    Join Date
    Oct 2007
    Location
    Stavern, Norway
    Posts
    292

    Default

    The code is really nice. one Q:
    Is it possible to exchange the LCD_out line with a constance?
    like ADC1read ?
    The best is yet to come

    Good enough - its perfect !!

    2 Gig of free online backup space

    cq cq de LA3BNA

  6. #6
    superbrew Okay
    Join Date
    Oct 2007
    Location
    Nashua, NH
    Posts
    101

    Default

    Do you mean:
    Code:
    LCD_Out(adc_read(1),0,0);
    
    Then, no. The LCD_Out function is looking for an ASCII string, if you give it an int it will out put random characters.

  7. #7
    Kryten Newbie
    Join Date
    Oct 2007
    Location
    Stavern, Norway
    Posts
    292

    Default

    No im using MicroC and are using the MMC lib. so i need the outputstring to be written to the MMC.

    And im going to write the avrage of 600 samples (one minute), are there any easy way of doing this?
    The best is yet to come

    Good enough - its perfect !!

    2 Gig of free online backup space

    cq cq de LA3BNA

+ Reply to Thread

Similar Threads

  1. HS1101 capacitive humidity sensor; need nearly linear voltage to feed to a 1-wire ADC
    By FirefighterBlu3 in forum Electronic Projects Design/Ideas/Reviews
    Replies: 6
    Latest: 30th December 2009, 06:23 AM
  2. Value of 16F877A ADC in decimal
    By Mortalo in forum Micro Controllers
    Replies: 5
    Latest: 18th December 2007, 03:43 AM
  3. ADC troubles
    By andy257 in forum General Electronics Chat
    Replies: 4
    Latest: 2nd December 2007, 05:49 PM
  4. Analog to Digital Converter (ADC)
    By simonmada in forum Electronic Projects Design/Ideas/Reviews
    Replies: 15
    Latest: 15th November 2007, 03:31 AM
  5. 16F877 Timer0 Interrupt Affecting ADC
    By sebana in forum Micro Controllers
    Replies: 13
    Latest: 12th September 2007, 09:43 AM

Tags for this Thread