You are on page 1of 1

IBPS

Railway Recruitment Board

/*
A parameter is like a placeholder. When a function is call on, you pass a value to
the parameter.
This value is referred to as actual parameter or argument. The parameter list
refers to
the type, order, and number of the parameters of a function.
Parameters are optional; that is, a function may contain no parameters.*/
#include <18F2550.h>
#device adc=8
long sensors_average,sensors_sum,last_proportional,line_position;
unsigned int i;
long qre[8]={0,0,0,0,0,0,0,0};

void read_sensor(unsigned char sensor)//return_type function_name( parameter


list );
{
set_adc_channel( sensor ); // Start reading by ADC channel X
//delay_us(75); // Waiting for ADC channel change
qre[sensor]= read_adc(); //Saves the result of the ADC variable
}

void pid_cal()
{

last_proportional=0;
sensors_average = 0;
sensors_sum = 0;
}

void main()
{
set_tris_a(0B10011111);
SETUP_PORT_A(AN0_TO_AN4_ANALOG);
setup_adc(ADC_CLOCK_INTERNAL );

You might also like