ECAPP Lab6 PDF
ECAPP Lab6 PDF
Diploma in CEN
Name: Class:
Facilitator’s Comments: Matric No:
Equipment:
i) Computer with USB ports
ii) ECAPP Target Board
iii) MPLAB ICD3
iv) Current measurement circuit board
v) Digital Multi-meter
Software:
i) MPLAB® X IDE v3.55
ii) XC8 ver1.41
References:
i) MPLAB® X IDE User’s Guide
The program below will blink the LEDs for five times and enter into sleep mode.
Upon an INT0 interrupt, the micro-controller resumes execution.
#include <xc.h>
#include <stdlib.h>
void main(void)
{
char i;
OSCCON = 0;
____________________ // Configure all ports as digital
____________________ // Configure RA<3:0> as outputs (LEDs)
____________________ // Configure RB3 as output (speaker)
while (1)
{
for (i=0; i<5; i++)
{
____________________ // Turn on all LEDs
__delay_ms(300);
____________________ // Turn off all LEDs
__delay_ms(300);
}
SLEEP(); // library function to execute sleep instruction
}
}
• Analyse the above program and predict what would happen when the program is
executed.
• Analyse the above program and predict what would happen when the INT0
interrupt occurs?
• Build the project, download the program into the PIC18F4520 flash memory and
run the application. Describe what you have observed.
• Use the current measurement board provided and the digital multi-meter to
measure the current at run mode and sleep mode, respectively. Calculate the
current saving at sleep mode.
~ END OF LABORATORY 6 ~