

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!


Class url: http://www.eng.yale.edu/enalab/courses/eeng460a/ Due date: October 6, 2004. Demonstration during TA’s office hours.
The purpose of this assignment is to familiarize you with the core concepts of embedded systems programming. For this task you will use the XYZ sensor node. After finishing this assignment you should be fluent with the following:
The assignment consists of two parts that are described in detail in the next sections. The starting code for this assignment is posted on the class website.
In this part you have to create a 3-bit binary counter on the XYZ sensor node. The value of the counter should be increased by 1 every second. When the counter overflows (current value of the counter is 7 and a second has elapsed) it should be automatically reset to its initial value: 0. The counter continues to count seconds even after an overflow. The current value of the counter should be monitored at all times on the 3 on-board LEDs (red, yellow and green). The most significant bit (MSB) of the counter should be monitored on the red LED, while the least significant bit (LSB) of the counter should be monitored on the yellow LED. A high level flowchart of the binary counter application can be seen in Figure 1. First, you have to select and configure the GPIO pins of the processor that are necessary to the application. Then, you have to configure one of the available hardware timers appropriately, so that you can count seconds. After initializing the hardware timer, create a timer handler that implements the 3-bit binary counter.
In this part of the assignment, you will learn how to use the internal ADC of the OKI processor to sample two of the on-board sensors: the light sensor and the accelerometer. Your task is to periodically sample these sensors and output the sample values either on the on-board LEDs or at the UART port.
GPIO pins configuration (LEDs)
ELAPSED TIME = 1 SECOND?
Configuration of a hardware timer to count seconds
Initialization of the 3-bit binary counter to value: 0
Monitor current value of counter on the LEDs
Start the hardware timer
Increase current value of counter by 1
COUNTER OVERFLOW?
Reset the value of the counter to value: 0
Monitor current value of counter on the LEDs
YES
NO
YES NO
Figure 1: High level flowchart of the 3-bit binary counter application.