Assuming fosc=4MHz, derive the following information from the program below: #in
ID: 3828307 • Letter: A
Question
Assuming fosc=4MHz, derive the following information from the program below:
#include <p18F452.h>
#include <stdlib.h>
#include <ADC.h>
#include <stio.h>
#include <delays.h>
Int X=0
void main (void) { While (1)
{
OpenADC (ADC_FOSC_32 & ADC_RIGHT_JUST & ADC_1ANA_0REF,
ADC_CH1 & ADC_INT_OFF); Delay1KTCYx(10);
Convert ADC( );
While (BusyADC( ));
X = ReadADC( );
Delay10KTCYx(200); }
}
a) The channel used
b) The number of sensors
c) The period of the A/D converter
d) The acquisition time
e) How often the measurements are done?
Explanation / Answer
c) The period of the A/D converter
#include <p18F452.h>
#include <stdlib.h>
#include <ADC.h>
#include <stio.h>
#include <delays.h>
Int X=0
void main (void) { While (1)
{
OpenADC (ADC_FOSC_32 & ADC_RIGHT_JUST & ADC_1ANA_0REF,
ADC_CH1 & ADC_INT_OFF); Delay1KTCYx(10);
Convert ADC( );
While (BusyADC( ));
X = ReadADC( );
Delay10KTCYx(200); }
}