Professional Documents
Culture Documents
Practical Work Ec501 - Lab 6 (B)
Practical Work Ec501 - Lab 6 (B)
CLO2, LD2 LAB 6 (B) : DATA ACQUISITION, ADC AND SENSOR INTERFACINGINTERUPPTS OUTCOMES By the end of the practical, student should be able to: i. ii. iii. iv. Implement simple data acquisition programming and interfacingusing transducer Illustrate ADC programming in C programming Illustrate program to interface sensor and signal condition Assemble, debug and execute program code using MPLAB
THEORY
PROSEDUR 1. Write the program below and execute the program using MPLAB: * Title:ADC_Setting using Lirary Delays.h Desc:Blink LED by adjusting Potientiometer at RA0 Author:Azhar Ramli Date modified:7/9/2013 */ #include <P18f4520.h> #include <delays.h> #pragma config WDT=OFF,OSC=HS #pragma config PBADEN=OFF,MCLRE=ON
for(;;) { ADCON0bits.GO=1; //START CONVERSION while(ADCON0bits.GO==1) continue; //CONTINUE CONVERSION Result=ADRESL; //RESULT LOAD TO ADRESL Result+=(ADRESH<<8); //SHIFT 8 TIMES TO ADRESH BECOME 10BIT MAX Result=(int)4.888*Result; Delay10KTCYx(Result); LED_1=0; Delay10KTCYx(Result); LED_1=1; } }
U1
AN0 2 3 4 5 6 7 14 13 33 34 35 36 37 38 39 40 RA0/AN0/C1INRC0/T1OSO/T13CKI RA1/AN1/C2INRC1/T1OSI/CCP2B RA2/AN2/C2IN+/VREF-/CVREF RC2/CCP1/P1A RA3/AN3/C1IN+/VREF+ RC3/SCK/SCL RA4/T0CKI/C1OUT RC4/SDI/SDA RA5/AN4/SS/HLVDIN/C2OUT RC5/SDO RA6/OSC2/CLKO RC6/TX/CK RA7/OSC1/CLKI RC7/RX/DT RB0/AN12/FLT0/INT0 RB1/AN10/INT1 RB2/AN8/INT2 RB3/AN9/CCP2A RB4/KBI0/AN11 RB5/KBI1/PGM RB6/KBI2/PGC RB7/KBI3/PGD RD0/PSP0 RD1/PSP1 RD2/PSP2 RD3/PSP3 RD4/PSP4 RD5/PSP5/P1B RD6/PSP6/P1C RD7/PSP7/P1D RE0/RD/AN5 RE1/WR/AN6 RE2/CS/AN7 RE3/MCLR/VPP PIC18F4520 15 16 17 18 23 24 25 26 19 20 21 22 27 28 29 30 8 9 10 1
OUT1 R2(1)
RV1
2R
R1 R2
220R AN0 10R
57%
D1
LED-RED
OUT1
QUESTION
REPORT Please include the following item in your report: 1. 2. 3. 4. 5. Title - 2m Outcomes 3m Result - 10 m Discusson and Question 20 m Conclusion 5 m
REFERENCE BOOK Muhammad Ali Mazidi, Rolin D. Mckinlay & Danny Causey (2008). PIC Microcontroller and Embedded Systems: Using Assembly and C for PIC18. Pearson Prentice Hall. (ISBN: 9780136009023
Course Code & Course: EC501 EMBEDDED SYSTEM APPLICATIONS Programme: DET5/ /DEP5/DTK5 Assessment task: PRACTICAL WORK 6 NAME :
RUBRIC OF PRACTICAL WORK LAB 6 (B) : DATA ACQUISITION, ADC AND SENSOR INTERFACINGINTERUPPTS Learning Domain (LD) No Aspects
Excellent The program code is complete with neat code-typing and well organized. Very Good Good The program code is complete after being assisted with quite-neat code-typing and fairly well organized. Fair Unsatisfactory The program code is incomplete with inconsistent code-typing and not well organized.
Points
10
B. ASSEMBLE PROGRAM AND EXECUTE PROGRAM Able to fix the errors from the given coding.
The program code runs smoothly without any error and warning.
5
The program code contains some errors and warning. Students able to run the program after being assisted.
1
The program code still contains errors and warning. Students fail to run the program.
20
C. SIMULATE THE PROGRAMME USING PROTEUS SOFTWARE Able to simulate the programme and see the changes in the status register indicates by LED using Proteus Software
Successful program and manage to get correct outputs in status register contents. Students fully understand the programme
10
Successful program after being assisted with some incorrect output in status register contents. Students understand most of the programme
2
Unsuccessful Program with completely incorrect output in status register contents. Student having difficulties to understand the programme
20
Prepared by, Lecturer (Signature and Stamp) Session: Jun 2013
10
Approved by,
. Head of Department / Head of Programme (Signature and Stamp) Session: Jun 2013