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.

Need help in ADC PIC16F877

Status
Not open for further replies.

Eng.Abbasi

New Member
hello every body
i need some help in this code and i have two Question
1. does the AD Converter in the Pic have different clock than the 20MHz
main clock of the pic cpu ? OR NOT . and if it have , when i write this program and especially in Label "WAIT3" can i make the cpu to make another task until the conversion process finish?
"the program in the attachments"
2. How can i determine the sampling frequency in the pic to be 300 HZ only ????

i'll be grateful if any one answer
thx
 

Attachments

  • ADC.txt
    463 bytes · Views: 337
At 300Hz that's nice & slow for the A/D, just set a timer for irqs 300 times a second. Timer 2 is good for this. 20MHz won't divide into 300 evenly. You might want to reconsider your crystal speed. 300Hz will work with most crystals designed to work with serial ports. 3686400 is common, and will divide perfectly.
 
Thanx MRs. WILLIAM but the problem not like that . first what do you mean by irqs?
then the real problem is in my project i have 3 bases operations:
1. to get the analog value from pic pins "at two channel" and convert it to digital and this is not problem.
2. to make calculation on this digital value -and here is problem ,how can i wait for the another analog value to come in either channel and the same time ihave to make calculation on the last value i got it before .
3. to send the value after calculation serialy by serial protocol and this need another clock .

•LPLow Frequency (Power) Crystal
•XTCrystal/Resonator
•HSHigh Speed Crystal/Resonator
•RCExternal Resistor/Capacitor (same as EXTRC with CLKOUT)
•EXTRCExternal Resistor/Capacitor
•EXTRCExternal Resistor/Capacitor with CLKOUT
•INTRCInternal 4 MHz Resistor/Capacitor
•INTRCInternal 4 MHz Resistor/Capacitor with CLKOUT

i know about these oscillators modes but i dont know if they are worked separatly or not and how to attach each one to each one of the 3 process i made .

i'll really be grateful if any one help me in this
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top