Docsity

Lab Document: Electronic Control Technology - LED Flashing and Tone Generation, Lecture notes of Microcomputers

Toggle sidebar
bg1
page 1 of 2
Prelab Five
Main Timer and Output Compare
For setting up the relevant ECT Module registers please refer to the document ECT_16B8C Block
User Guide V01.02 and the Instructor's Notes posted on the Class Web Page.
Port T (PT.7 โ€“ PT.0) is designated as the ECT special function port pins.
Port H (PH.7 โ€“ PH.0) is designated as the parallel output port.
Port A (PA.7โ€ฆPA.0) is designated as input port for this lab.
Task๎˜ƒOne๎˜ƒ
The designated output port bit is Port H Bit 4 (PH.4). The LED should flash at the rate approx.
3.0Hz.
The PH.0 signal should be buffered by a suitable chip to provide enough current for the LED. Draw a
detailed schematic diagram for Task One. It should include an IC part number, IC pin numbers, and
H1 Connector pin numbers. All signal lines should be labeled.
You should develop a C program to flash the LED at the specified rate. The program should run in an
infinite loop. The timing should be based upon Timer Overflow (TOF) Interrupts.
Task๎˜ƒTwo๎˜ƒ
The Output Compare function should be implemented using Timer Channel 3 (PT.3). It should
output a signal at 440 Hz, 50% duty cycle (A above middle C on a piano).
Note: Piano key frequencies are related as
()
4402 12
49
โ‹…= โŽŸ
โŽ 
โŽž
โŽœ
โŽ
โŽ›โˆ’n
nF for n=1:88
See http://en.wikipedia.org/wiki/Piano_key_frequencies
The PT.3 signal should be buffered by a suitable chip. Draw a detailed schematic diagram for
Task Two. It should include an IC part number, IC pin numbers, and H1 Connector pin numbers.
All signal lines should be labeled.
Develop a C program that will generate the output signal specified above. The program should
run in an infinite loop. TC3 interrupts should be used to create the output signal.
Task๎˜ƒThree๎˜ƒ
The two input signals should be driven by DIP-Switches. The designated input port bits are PA.1
and PA.0, respectively. The status of the input signals should be read at approx. 100ms intervals.
The output signal should be generated using Timer Channel 3. The conditions are as follows:
- if PA.1 is High and PA.0 is High, then the output signal frequency is approx. 1760 Hz,
60% duty cycle,
pf2

Partial preview of the text

Download Lab Document: Electronic Control Technology - LED Flashing and Tone Generation and more Lecture notes Microcomputers in PDF only on Docsity!

page 1 of 2

Prelab Five

Main Timer and Output Compare

For setting up the relevant ECT Module registers please refer to the document ECT_16B8C Block User Guide V01.02 and the Instructor's Notes posted on the Class Web Page.

Port T (PT.7 โ€“ PT.0) is designated as the ECT special function port pins. Port H (PH.7 โ€“ PH.0) is designated as the parallel output port. Port A (PA.7โ€ฆPA.0) is designated as input port for this lab.

Task One

The designated output port bit is Port H Bit 4 (PH.4). The LED should flash at the rate approx. 3.0Hz.

The PH.0 signal should be buffered by a suitable chip to provide enough current for the LED. Draw a detailed schematic diagram for Task One. It should include an IC part number, IC pin numbers, and H1 Connector pin numbers. All signal lines should be labeled.

You should develop a C program to flash the LED at the specified rate. The program should run in an infinite loop. The timing should be based upon Timer Overflow (TOF) Interrupts.

Task Two

The Output Compare function should be implemented using Timer Channel 3 (PT.3). It should output a signal at 440 Hz, 50% duty cycle (A above middle C on a piano).

Note: Piano key frequencies are related as ( ) 2 12 440

49 = โ‹…

โŽœโŽโŽ›^ n โˆ’ โŽŸโŽ โŽž F n for n=1:

See http://en.wikipedia.org/wiki/Piano_key_frequencies

The PT.3 signal should be buffered by a suitable chip. Draw a detailed schematic diagram for Task Two. It should include an IC part number, IC pin numbers, and H1 Connector pin numbers. All signal lines should be labeled.

Develop a C program that will generate the output signal specified above. The program should run in an infinite loop. TC3 interrupts should be used to create the output signal.

Task Three

The two input signals should be driven by DIP-Switches. The designated input port bits are PA. and PA.0, respectively. The status of the input signals should be read at approx. 100ms intervals. The output signal should be generated using Timer Channel 3. The conditions are as follows:

  • if PA.1 is High and PA.0 is High, then the output signal frequency is approx. 1760 Hz, 60% duty cycle,

page 2 of 2

  • if PA.1 is High and PA.0 is Low, then the output signal frequency is approx. 880 Hz, 40% duty cycle,
  • if PA.1 is Low and PA.0 is High, then the output signal frequency is approx. 440 Hz, 50% duty cycle,
  • if PA.1 = PA.0 = Low, then the Output Compare function should be disabled and the output signal level is High.

Port A signals should be buffered by a suitable chip to pass the signals from the DIP-switch module to Port A (and for protection). The input signals to the buffer chip should exhibit either low (0V), or high (5V) logic levels. No intermediate voltage levels are permitted. In addition, you should also guarantee CMOS-compatible High signal levels at PA.1 and PA.0.

(Question: Could you use an 8-input dip switch and make all the frequencies that relate to a piano?)

Task Four

The Flash memory area starts at 0x4000. Instructions on programming your C code to the Flash will be given in the lab (and it is also posted on the Class Web Page). You will also be given the know how to restore the D-Bug12 Monitor program after you have completed Task Four.