Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

ADC readout to Decimal

Status
Not open for further replies.

Kryten

New Member
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
 
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
 
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.
 
The code is really nice. one Q:
Is it possible to exchange the LCD_out line with a constance?
like ADC1read ?
 
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.
 
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?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top