

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


EEE20003 Tutorial - 2
Q1. The figure below shows some simple devices connected to Port C of a MK20DX128M5.
Write code snippets to do the following without disturbing any other outputs (after the initialisation).
a) Use direct manipulation of the GPIO and PORT registers e.g. PCR, PDDR etc.
Declarations
Initialisation of GPIOs
Enable the clock to the port Initialise the used device pins. Initialise the GPIO
Turn on the LED.
Turn off the LED.
Toggle the LED (i.e. if on turn off, if off turn on).
Change the 7-segment display to 0.
Change the 7-segment display to 5.
Change the 7-segment display to the value in the integer variable sevenSegment.
b) Is the LED active-high or active-low?
Encoder
Driver
EEE20003 Tutorial - 2
Q2. Write a reaction-timing program in C. The program uses a press button and LED as shown below.
Basic Operation
For this exercise assume the existence of a delay1ms() and delayRandomTime() functions.