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.

16F877a ADC.. how to analyze 10bits.

Status
Not open for further replies.

Peter_wadley

New Member
Hey,

I just wrote my first AD converting program for the 877a..

I need help on how to analyze the 10bits of ADRESH and ADRESL...

How do we analze 10bits when W can only hold 8bits?

Just to make sure my program works I left justified the output.. Then I used only the bits in ADRESH to ensure proper function.

Everything worked fine (Used a POT to turn on 3 LEDs sequentially)

I also couldnt find this on PIClist.

So how do you analyze 10bits with an 8bit MCU?

Thank you
 
Last edited:
Use 16 bit maths routines, there are plenty of examples on the PICList of 16 bits maths. BUt for what you're doing, you don't need anywhere near 10 bits, and you're doing it correctly using it in 8 bit mode.
 
Hi I just wanted to add one more open question to this thread..

Id like to try and make one of those analog Audio meters with the 877a ADC...

hmm how to go about doing this..

I dont know which op-amp I should choose..

Id like either an electret mic or audio from say an IPOD to enter the opamp.. the output will go to a 4ohm speaker and also to an ADC on the 877a.. or 12F675 if i get them soon..

Then, just like in the program I made above a line of LEDs would portray the magnitude of the music or voice..

Im sure you know exactly what Im talking about so Ill leave it to suggestions now..

My main question is - do op-amps output a voltage range from vss right up to vdd? or are we talking only millivolts here?

thanks
 
You may well need to amplify it to make it large enough, also you need to rectify it, so it's DC - check for VU meter ciruits, which is what you're wanting to make.
 
Peter_wadley said:
My main question is - do op-amps output a voltage range from vss right up to vdd?

General purpouse op amps don't usually operate to the rails.
If you're using a single supply source, the op amp must swing to the negative rail (ground, in that case).

The PIC12F675 have 5 output pins.
Seems like they're not enough for your project, are they?
 
You know there are 2 register ADRESH and ADRESL...ADRESH contains the high bits,ADRESL contains the low bits..For example ;

ADCON0=0x7f; // Start ADC
while((ADCON0&4)!=0); // Wait for convert
value=ADRESH;
value=256*value+ADRESL;
heat=value*lsb*100.0;
...
...
...

My english isnt well,excuse me..
 
eng1 said:
General purpouse op amps don't usually operate to the rails.
If you're using a single supply source, the op amp must swing to the negative rail (ground, in that case).

The PIC12F675 have 5 output pins.
Seems like they're not enough for your project, are they?

When you say swing to ground do mean that as the signal increases on the non inverting input.. the voltage on the output (before the dc filtering cap) will drop?

If this is the case.. could I just find the voltage range of the output (from no sound to loudest sound) Then use that .. say .5 voltage range to divide the LED stages..

Would I connect the analog input directly to the op-amp output or after the filtering cap?

I guess I could multiplex the outputs :( or get a larger PIC.

You know there are 2 register ADRESH and ADRESL...ADRESH contains the high bits,ADRESL contains the low bits..For example ;

ADCON0=0x7f; // Start ADC
while((ADCON0&4)!=0); // Wait for convert
value=ADRESH;
value=256*value+ADRESL;
heat=value*lsb*100.0;
...
...
...

My english isnt well,excuse me..

Im sorry I only know assembly.

You may well need to amplify it to make it large enough, also you need to rectify it, so it's DC - check for VU meter ciruits, which is what you're wanting to make.

Dont op-amps output a changing DC current which goes through a cap to become AC?

Well im talking more about audio op-amps I guess since the speakers need AC..
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top