Docsity

Embedded Network Systems - Programming Assignment 1 | EENG 460, Assignments of Electrical and Electronics Engineering

Toggle sidebar
bg1
EENG460a/CPSC436/ENAS960
Programming Assignment #1
Professor Andreas Savvides
Teaching Assistant: Dimitrios Lymberopoulos
dimitrios.lymber[email protected]du
September 21, 2004
Class url: http://www.eng.yale.edu/enalab/courses/eeng460a/
Due date: October 6, 2004. Demonstration during TA’s office hours.
1 Introduction
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 XYZ’s architecture.
•Configuring the GPIO pins of the OKIML67Q5002 processor.
•Programming and using the OKIML67Q5002’s hardware timers.
•Sampling the on-board sensors.
•Programming and using the UART interface
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.
2 Part 1 (GPIO and Timers)
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.
3 Part 2 (Sensor sampling, ADC, UART)
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.
pf3

Partial preview of the text

Download Embedded Network Systems - Programming Assignment 1 | EENG 460 and more Assignments Electrical and Electronics Engineering in PDF only on Docsity!

EENG460a/CPSC436/ENAS

Programming Assignment

Professor Andreas Savvides

[email protected]

Teaching Assistant: Dimitrios Lymberopoulos

[email protected]

September 21, 2004

Class url: http://www.eng.yale.edu/enalab/courses/eeng460a/ Due date: October 6, 2004. Demonstration during TA’s office hours.

1 Introduction

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 XYZ’s architecture.
  • Configuring the GPIO pins of the OKIML67Q5002 processor.
  • Programming and using the OKIML67Q5002’s hardware timers.
  • Sampling the on-board sensors.
  • Programming and using the UART interface

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.

2 Part 1 (GPIO and Timers)

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.

3 Part 2 (Sensor sampling, ADC, UART)

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.