ee3954_fall13_10_adc

Use interrupts wait for the adc interrupt read ad

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: t Configure A/D Module Configure A/D Interrupt* Wait for TACQ Start Conversion (set GO) Wait for conversion to complete Use POLLING: Keep checking the DO/DONE bit, if it is cleared the conversion is done. Use INTERRUPTS: Wait for the ADC interrupt Read A/D Result Wait for at least 2TAD before next acquisition *if desired ADC.44 ADC An Example RA1/AN1 PIC16F877 Write a program that makes continuous measurements of the output voltage of the microphone and writes the results to TEMPH (0x20) and TEMPL (0x21) Assume that the Oscillator frequency clock is 4MHz ADC.45 Example Configure A/D Module Configure A/D Interrupt* Wait for TACQ Start Conversion (set GO) Wait for conversion to complete Read A/D Result Wait for at least 2TAD before next acquisition ADC.46 Example Configure ADC Module 0 1 Conversion clock 4MHz < 5MHz thus ADCS1:ADCS0 = ’01’ 1 0 0 1 0 Result is Right Justified thus ADFM = ‘1’ 0 0 0 1 Turn on Module: ADON = ‘1’ RA1/AN1 thus CHS2:CHS0 = ‘001’ 0 0 0 0 0 RA1/AN1 thus PCFG3:PCFG0 = ‘0000’ ADC.47 Code Configure ADC Module ADCON0 ADCON1 INIT_ADC: equ equ org movlw movwf...
View Full Document

Ask a homework question - tutors are online