The program below corresponds to an embedded system that uses a crystal oscillat
ID: 659372 • Letter: T
Question
The program below corresponds to an embedded system that uses a crystal oscillator of a frequency 1MHz. Identify and correct the errors in this program.
#include <p18F452.h>
#include <stdlib.h>
#include <adc.h>
void main (void)
While (1)
{
For (i=0; i<24; i++)
{
OpenADC (ADC_FOSC_16 & ADC_RIGHT_JUST & ADC_1ANA_0REF, ADC_CH1 & ADC_INT_OFF)
Convert ADC( )
While (BusyADC( ));
Pressure[i]= ReadADC( );
}
For (j=0; j<1,000; j++)
Delay10KTCYx(90); // One hour delay
}
Explanation / Answer
First of all headerfile is incorerect i.e.# include <p18F452.h> it can't be this. It should be< iostream.h> it means basic libarary input and output function then program will generate all its input and output function from its liberary.
Loops are overlooping as we define in while the value is 1 and inside this we start a loop for we start it with 0. So loops can't be overlooping.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.