Free Embedded Systems Engineering Report Essay Sample
Buy Cheap Embedded Systems Engineering Report Essay
To come up with a program in "C" for the PIC16F877 microcontroller that will enable it emulate a system for data acquisition. The program will involve the conversion of two analogue variables to digital equivalents at a given interval of time which will be then displayed on the LCD screen. To achieve this, the Light Dependent Resistor (LDR) and the PIC development boards' potentiometer will be used. The various push buttons on the LCD are important in the provision of user input and output.
1. To write a well structured and annotated "C" program using the IAR cross compiler
2. To demonstrate a program that is functional
i. At the beginning, S-T was entered on the top line of the LCD.
ii. The RB6 push button was pressed and held down in order to increase the sampling time from 1 to 10 seconds that was displayed on line 2 of the LCD. After the required sampling time interval was achieved, the push button was released. When 10 seconds were exceeded, the display could roll to one second.
iii. The RB7 push button was pressed to start the sampling LDR and the potentiometer at regular intervals. To stop the sampling, the RB7 button was pressed again. To start a new sampling session, the RB7 push button was pressed again. The displays of the values of the sampled data with their respective averages on the LCD were as shown below.
In the calculation of the ambient temperature and the intensity of light, the following important assumptions were made.
a. 0 OC was taken to the lowest setting of the potentiometer.
b. 50 OC was assumed to be the maximum setting of the potentiometer.
c. LDR was assumed to be totally/100% uncovered.
The RB6 push button was used to set the sampling time in 1-10 seconds and the RB7 was used to start and stop sampling LDR and POT at regular intervals.
The data acquisition systems are normally used to collect data in the remote places. For example, the temperature variation data and the water PH data can be collected and used by scientists in studying the global warming effect and water pollution respectively. To be able to collect the data, the data acquisition system is programmed to take readings at specific intervals over a long time period. The system then uploads the stored data at the end of the session which is analyzed by the concerned experts. The LCD device that is interfaced to a port of a microcontroller is used in this process. The ADC is converts the analogue data that comes from the sensor into digital data which is easily understood by the microcontroller. Below is a block diagram for the standard data acquisition system.
The PIC16F877 microcontroller is used to measure the temperature and variation in the ambient light with the help of the potentiometer and light dependent resistor as the sensors respectively. The potentiometer and the light dependent resistors produce analogue outputs. For the PIC16F877 microcontroller to process the data, it must be converted to digital form using an analogue to digital converter. For instance, ADC is used to convert the input/analogue values from the sensors to their respective digital forms. The 10 bit ADC is used in this process and timer 1 interrupt is used to generate the desired sampling time in seconds. The counts that are generated by the ADC are converted into the respective temperature and light intensity values which are displayed together with their averages on the LCD.
The 10 bit AD was used and the ADCON1 and ADCON2 registers were configured for the required operation. ADC was in uni-polar mode. Port A of the microcontroller was used to connect the LDR and POT. The LDR was connected to the channel 0 and POT was connected to the channel 1. The clock frequency was used as Fosc/8 and hence ADC2, ADC1 and ADC0 were 001. LDR CHS2, CHS1 and CHS0 were 000 and for POT 001. Initially ADC was off hence GO and ADON were 0. The right justified result format was used and hence ADFM=1. Since all the inputs were analogue, PCFG3, PCFG2, PCFG1, PCFG0 = 0000.
The formula T=50*counts/1023 was used to calculate the temperature. The formula was derived through the following process.
When the POT gave 0 counts it meant that the temperature was 0 and when it gave the maximum counts i.e. 1023 it meant that the temperature was 50oC.
Average temperature was calculated by obtaining the sum of all temperature change readings and dividing them by the number of changes.
The formula L= (counts-860)/ (-6.63) was used to calculate the light intensity and it was derived with the help of a straight line equation of a line which does not pass through the origin i.e. Y=mX+c.
Where Y= counts, X=light intensity, M= -6.64 (Slope of the line) and C= 860.
The values of C and M were calculated from the readings. The uncovered LDR gave 129 counts and 860 counts when covered.
At the start the menu was displayed on the LCD. The next menu was displayed when RB6 was pressed and it kept rolling till the RB6 button was pressed. When Rb6 was relapsed, a particular sampling time was selected. The RB7 button was pressed and the ADC started the POT data acquisition and it calculated the temperature and average temperature value from the counts. After this, a delay was provided before the data for LDR was acquired. The light intensity and its average were then calculated. Finally, the RB7 was pressed and the sampling stopped. It returned to the initial menu ready to start a new session.