Interfacing Assignment
The purpose of the Interfacing Assignment is for each of your group members to:
  • demonstrate that you can successfully follow the embedded system development cycle;
  • demonstrate that you are able to program the microcontroller used in your project to perform a (limited) task;
  • demonstrate that you can plan (via a flowchart) structured code development;
  • demonstrate that you are able to code to acceptable standards (documenting, source file layout, etc.); and
  • make a small step toward your final project's firmware design.
Please note that each individual is expected to complete one of the assigned exercises. Allocation of particular exercises to individual group members is left to your group.

The exercises are described toward the end of this page and are intended to focus you on MCU peripherals that will likely be used by your project. (In the event that your project has no embedded controller, you will be expected to demonstrate certain (limited) aspects of your system design, as discussed with individual groups.) In some situations assignments are made to allow you to explore an alternate approach to interfacing that you may not use in your final approach.

Demonstrate your working interfacing assignment programs to your primary GTA prior to 4PM in the lab period on the due date (particular to your laboratory section). Please refer to the course syllabus for the due date particular to your lab section.

Also by 4PM on the lab-section-specific date noted on the syllabus, please submit the following items for the particular Interfacing Assignment that you are responsible for to the course submission box outside the ECE General Office:
  • The signed GTA form (which will serve as a title page);
  • the flowchart for the firmware; and
  • a printed copy of the source code corresponding to the demonstrated exercise.
Only code that is written (or modified) by you needs to be provided. Libraries written by others, for instance, do not need to be included. If a file is modified by you, please include the file header and the routines that were modified. Hand annotations to indicate to grader which work is yours is encouraged.

Note, too, that as with any work, sources must be cited.

Please ensure that your code is commented and structured appropriately. Additionally, when printing, please ensure that lines are not truncated.

To potentially save yourself a lot of work, please check over the code provided on the course website: libraries, demos, and macros are provided for you and are intended to be used!

Evaluation

  • 20% of the mark will be awarded for demonstration of the code to your GTA.
  • 80% is allocated for evaluation of coding standards, flowcharts, etc.
A further breakdown can be found on the cover sheet provided for you.

The marker will be asked to evaluate the following items. However, please note that this list is not complete nor is it intended to imply a mark breakdown.
  • Source header comments.
  • Subroutine/function header comments.
  • Code structure: modularity, correct termination, source code flow, etc.
  • Appropriate flowchart symbols and symbol interconnection.
  • Appropriate level of flowcharting: this is to be at a low-level: almost direct correspondence between the flowchart and the source code.
The level of commenting expected is demonstrated in the code provided on the course web page. It is not necessary (or desirable) to comment every source line!

Late Work

Late submissions of the paper document (code, coverpage, etc.) are docked at a rate of 25% per business day (or portion thereof) and is applied to the total grade.

Exercises

The following list provides more detail about the programming/interfacing checkoffs that have been assigned:

1. A/D + UART
Write a program that continuously displays a value sampled from an A/D input channel on the terminal (through the UART) in hexadecimal.
2. A/D + 8-bit compare
Write a program that continuously compares a value sampled from an A/D input against an 8-bit threshold value (0x00-0xFF) and makes a digital output high only if the MSByte of the A/D value exceeds this.
3. A/D + 10-bit compare
Write a program that continously compares a value sampled from an A/D input against a 10-bit threshold value (0x000-0x3FF) and makes a digital output high only if the A/D input exceeds this.
4. A/D + A/D + 10-bit compare
Write a program that compares two values sampled from different A/D inputs against each other and makes a digital output high only if the lower channel exceeds the value on the upper channel.
5. DI + PWM
Write a program that outputs a 75% duty cycle waveform at 1kHz on a PWM pin when a digital input is high, and 25% duty cycle when the input is low.
6. A/D + LCD
Write a program that continuously displays a value sampled from an A/D input channel on the upper-left hand corner of the LCD in hexadecimal.
7. DI + LCD
Write a program that continuously checks the state of an input pin and displays a message on the LCD relating the level: 'Port XX: 0' or 'Port XX: 1'.
8. UART + PWM
Write a program that outputs a 25% duty cycle, 1 kHz waveform on a PWM pin when the character 'L' is received on the UART. Change the duty cycle to 75% if the character 'H' is received. Debugging messages on the terminal screen are encouraged.
9. UART + LCD
Write a program that continuously receives characters through the UART and displays them in the bottom-right corner of the LCD.
10. UART + DO
Write a program that allows control over a digital output via the terminal. When the character 'H' is received, make the digital output high. When the character 'L' is received, make the digital output low.
11. A/D + SPI O/P
Write a program that continuously samples a value on an A/D input and transfers out the most-significant 8 bits of the result to a 74HC595 serial-to-parallel IC using the SPI facility.
12. SPI I/P + DO
Write a program that continuously transfers 8-bits of data from a 74HC165 parallel-to-serial IC into the microcontroller using the SPI facility, and outputs this identical byte on 8 digital outputs.
13. DI + UART
Write a program that relates the state of a digital input on the terminal through the UART. When the pin is high, display the message 'Port XX : High', and when low 'Port XX : Low'. Only display these messages once per transition of the input signal.
14. DI + DO
Write a program that continuously accepts the levels of 4 digital inputs, calculates the 4-bit 2's complement of this value, and places the result on 4 digital outputs.
15. Asynch TMR/PA/INT + LCD
Write a program that continuously counts the number of input pulses on a pin in one second and displays this value (in hexadecimal) on the LCD in the bottom left corner. This counting is to occur via one of the following MCU facilities: pulse accumulator, asynchronous timer, or interrupt input.
16. Input Capture + UART
Write a program that continuously measures the width of an input pulse using the Input Capture facility and displays the resulting 16-bit width (timer value) in hexadecimal on a terminal connected via the UART. Disabling the ICx facility during display is acceptable.
17. Input Capture + LCD
Write a program that continuously measures the width of an input pulse using the Input Capture facility and displays the resulting 16-bit timer value in hexadecimal at the bottom right of the LCD. Disabling the ICx facility during display is acceptable.
18. DAC
Write a program that generates a simple sawtooth waveform using 10 sample values.
19. Output Compare
Write a program that uses an output compare facility to generate a 2kHz, 20% duty cycle square wave.
20. Asynch Timer/PA/INT + UART
Write a program that continuously counts the number of input pulses on the pin in one second and displays this value (in hexadecimal) on a Terminal screen on the PC connected through the UART. The counting is to occur via one of the following three facilities: asynchronous timer, pulse accumulator, or interrupt input.
21. DI + SPI O/P
Write a program that continuously checks the state of 8 input pins (a byte) and transfers this byte out through the SPI to a 74HC595 serial-to-parallel converter.
22. UART + SPI O/P
Write a program that continuously accepts bytes sent by a terminal connected via the UART, and transfers the byte to a 74HC595 serial-to-parallel IC using the SPI facility.
23. Analog Comparator + DO
Write a program that continually compares the voltage on an analog input pin with an internally-generate reference by way of the on-board analog comparator. When the voltage exceeds this reference, make a digital output high, otherwise low.
24. TCP/IP Ping
Write code that allows the TCP/IP module to respond to TCMP (Ping) requests.
99. Technology-Specific
This is a group-specific assignment. Details will be provided.