Void Putleds - Embedded Real-Time System Programming - Lab, Exercises of Computer Programming

Some concept of Embedded Real-Time System Programming are Anatomy, Cache Access Time, Instruction Formats, Instruction Formats, Instruction Formats, Multidimensional Meshes, Network Processors, Snooping Protocol. Main points of this lecture are: Void Putleds, Exercise, Programs, Unsigned, Method, Digit Binary-Coded-Decimal Number, Manual, Direction Register, Data Register, Schematics

Typology: Exercises

2012/2013

Uploaded on 04/30/2013

ekaan
ekaan 🇮🇳

4.5

(4)

54 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Embedded Real-Time System Programming
Lab Exorcise 1:
This exercise is to be done in groups of two. You will probably want to search the example programs for help.
1. Write a program in C that uses the 8 LED’s:
You can use the method: void putleds ( unsigned int i);
2. Write a program that uses the 8 Dip Switches:
You can use the method: unsigned int getdipsw ();
3. Write a program that uses the 4 7-segment LED’s:
You can use the method: void putdisp ( unsigned int i);
{the display expects a 4 digit Binary-Coded-Decimal number}
4. Write a program that uses the A/D converter as an output device:
a. See the MCF5282 User’s Manual (There is a link in the Platform Hardware document) Sections 27.4 & 27.6
b. Set the sim.qadc.ddrqa Port A Data Direction Register for pins 0,1,3, & 4 to be digital outputs
c. Set the outputs with sim.qadc.portqa Port A Data Register
d. Use the Oscilloscope to observe the output (s). (See the Schematics in the Platform Hardware document)
{ PLEASE BE VERY CAREFUL using the scope probes! We don’t want to sacrifice any NetBurners}
5. We now want to exercise the A/D converter in it primary analog conversion mode. Attached is a sample program. It is
similar to the one supplied with the NetBurner. I made a few changes to “clean it up”. We will use it to understand how the A/D
converter is set-up and used in its basic primary mode.
Find the functionality provided by :
#include <..\mod5282\system\sim5282.h>
and describe how it defines the object variables used to program the A/D converter.
Become familiar with the program. Confirm that the set-up of the A/D converter makes sense. In you report, you should
explain the settings used.
Run the program and confirm that it produces the output you expected. Don’t put any inputs on the 8 A/D channels yet.
Observe the outputs and explain what you observe.
Put 0 volts (gnd) or 5 volts on one A/D inputs and observe the value in the output. Put the voltage (0 or 5 volts) on other
A/D inputs and observe that the A/D values are appropriately displayed in the output.
RECHECK THE RAMP WAVE ON YOUR FUNCTION GENERATOR AND HAVE YOUR LAB PARTNER
CONFIRM THAT IT IS CORRECTLY SET (1 volt to 4 volt swing). IT IS IMPORTANT THAT YOU NEVER
PLACE A NEGATIVE VOLTAGE OR A VOLTAGE GREATER THAN 5 VOLTS ON AN A/D INPUT! Keep the
waveform displayed on your scope.
Docsity.com
pf3

Partial preview of the text

Download Void Putleds - Embedded Real-Time System Programming - Lab and more Exercises Computer Programming in PDF only on Docsity!

Embedded Real-Time System Programming

Lab Exorcise 1:

This exercise is to be done in groups of two. You will probably want to search the example programs for help.

1. Write a program in C that uses the 8 LED’s:

You can use the method: void putleds ( unsigned int i);

2. Write a program that uses the 8 Dip Switches:

You can use the method: unsigned int getdipsw ();

3. Write a program that uses the 4 7-segment LED’s:

You can use the method: void putdisp ( unsigned int i);

{the display expects a 4 digit Binary-Coded-Decimal number}

4. Write a program that uses the A/D converter as an output device:

a. See the MCF5282 User’s Manual (There is a link in the Platform Hardware document) Sections 27.4 & 27.

b. Set the sim.qadc.ddrqa Port A Data Direction Register for pins 0,1,3, & 4 to be digital outputs

c. Set the outputs with sim.qadc.portqa Port A Data Register

d. Use the Oscilloscope to observe the output (s). (See the Schematics in the Platform Hardware document)

{ PLEASE BE VERY CAREFUL using the scope probes! We don’t want to sacrifice any NetBurners}

5. We now want to exercise the A/D converter in it primary analog conversion mode. Attached is a sample program. It is

similar to the one supplied with the NetBurner. I made a few changes to “clean it up”. We will use it to understand how the A/D

converter is set-up and used in its basic primary mode.

  • Find the functionality provided by : #include <..\mod5282\system\sim5282.h>

and describe how it defines the object variables used to program the A/D converter.

  • Become familiar with the program. Confirm that the set-up of the A/D converter makes sense. In you report, you should

explain the settings used.

  • Run the program and confirm that it produces the output you expected. Don’t put any inputs on the 8 A/D channels yet.

Observe the outputs and explain what you observe.

  • Put 0 volts (gnd) or 5 volts on one A/D inputs and observe the value in the output. Put the voltage (0 or 5 volts) on other

A/D inputs and observe that the A/D values are appropriately displayed in the output.

  • RECHECK THE RAMP WAVE ON YOUR FUNCTION GENERATOR AND HAVE YOUR LAB PARTNER

CONFIRM THAT IT IS CORRECTLY SET (1 volt to 4 volt swing). IT IS IMPORTANT THAT YOU NEVER

PLACE A NEGATIVE VOLTAGE OR A VOLTAGE GREATER THAN 5 VOLTS ON AN A/D INPUT! Keep the

waveform displayed on your scope.

  • Connect the ramp waveform to an A/D input and observe the output. Why is it difficult to see the waveform change?
  • Modify the program to be able to print out successive samples of one A/D input. This will require that you change the

setup of the queue to store successive samples of one channel.

  • Looking at the set-up, what do you believe the sampling rate is? Measure the sampling rate.
  • Change the frequency of the input until you can observe “aliasing”. Explain what is happening here.
  • What can you say about the linearity and accuracy of the converter? Each student should submit a report. The report should include the well documented programs suitable for sharing with others. It should clearly explain how the devices work and are being exorcized. Identify references used, give your team member credit for his contributions, and acknowledge appropriately help received from others.