Laboratory 1 Name: - : Embedded and Realtime Systems
Laboratory 1 Name: - : Embedded and Realtime Systems
of Electronic Engineering
Laboratory 1
INSTRUCTIONS
Name:____________________
This laboratory should be completed within the 3 hours allocated and handed up at the end of the lab. Be sure to include your name on all your work. Parts 1, 2, 4 and 5 of the Laboratory exercise should be answered in the space provided. Be sure to include a printout of your source code with your answers. Dont forget to include your name. Copying will be penalised DETAILS Figure 1 below depicts a basic configuration of an embedded system based around the PIC16F877. The circuit consists of the following: Fosc : SW1 : SW2 : LED1 : LED2 : Vdd
1
MCLR Vdd
9
4 Mhz Xtal
SW 1 22 SW 2 23
PIC16F877
OSC2 RB0 RB1 RA4 RB2 Vss Vss
10 17 16 R2 LED 1 R1
15pF
19
LED 2
0V
Embedded and Realtime Systems The desired function of the circuit is given in Table 1.
SW1 1 1 0 0
SW2 1 0 1 0
Laboratory Exercise 1. Using Pseudo code, outline the design of the program for the above. (10 marks) 2. List the Special Function Registers associated with this program task and detail the bit configuration for each. (10 marks) 3. Using MPLAB create a project and write the C program for the above. Include good comments and a title section for your code. (35 marks) 4. Verify the function of the program using the MPLAB Simulator. Document your step by step verification procedure. (25 marks) 5. Download your program to the PICDEM 2 board and verify that your program works. (20 marks)
Notes: 1. The Sample Lab in the first Lab/Tutorial is very similar to this lab please refer back. 2. After creating a project in MPLAB ensure that the configuration bits are set either in the code or in MPLAB.
Answer to Laboratory Exercise 5 Show lab demonstrator software working on PICDEM2 board. Lab demonstrator to sign off on this: