# homework12

Shared by:
Categories
Tags
-
Stats
views:
0
posted:
1/20/2013
language:
Unknown
pages:
4
Document Sample

```							Assigned: 04/13/2006                                                          Due: 04/20/2006

CprE 211 – Spring 2006
Homework 12
Name:
Lab section #:
Email ID:

NOTE: This homework will NOT be collected or graded. However, it is strongly suggested that
you work out the answers by the due date.

TPU Programming: Input Capture and Output Compare

1. How many events will be captured from the following input waveform? If the events
be captured with regard to TCR2, what are their times?

2. Draw the output waveform given that events are generated with regard to the TCR2 in
(1) at the following times: 101, 103, 104, and 105. The initial output signal state is low.
Each event toggles the signal level.

1
Assigned: 04/13/2006                                                           Due: 04/20/2006

3. Suppose that the TPU is set up to perform the Output Compare function; and the Offset
is initialized to a count corresponding to 1 msec. You can modify the output signal with
the following operations after starting OC:
a. force to 1 immediately
b. force to 0 immediately
c. leave unchanged immediately
d. force to 1 after offset
e. force to 0 after offset
f. toggle after offset
g. leave unchanged after offset

What sequence of operations specified above (a-g) will result in a pulse train that always
starts high, has a period of 2 msec and 50% duty cycle? Give the letters.

Give a different sequence of operations that will result in a pulse train with a period of 2
msec and 50% duty cycle? Give the letters.

4. To generate the following waveform with regard to TCR2, what should be the value
of TBS, PAC and PSC? (Assume TCR1 is to captured at the time of match.)

REF_TIME1

offset

Ref_Time = REF_TIME1
+ offset

2
Assigned: 04/13/2006                                                         Due: 04/20/2006

5. Write pseudo code for the following TPU programming. You can use the notations in
the lecture slides. For example, use “CFSR[2]  0xA” for assigning value 0xA to the 4-
bit field of CFSRs (Channel Function Select Register) associated with channel 2.

Program the TPU Channel 0 for input capture function as follows. It should count 100
rising transitions. The interrupt handler for this function should compute the average time
between these transitions, AVG_TRANS_TIME. It should program the PIT to raise an
interrupt at the period given by AVG_TRANS_TIME. The PIT interrupt handler checks
to see if at least one transition was captured since the last PIT interrupt. If not, it
reprograms the TPU Channel 0 to increment its MAX_COUNT (which is 100 initially)
by one.

3
Assigned: 04/13/2006                                                   Due: 04/20/2006

Host interface for an input capture channel:

Recall TPU channel programming:
TPU Interrupt configure register (TICP): to set interrupt level, not concerned
Channel Interrupt Enable Register (CIER): to enable interrupt
Channel Interrupt Status Register (CISR): interrupt status, not concerned
Channel Function Select Register (CFSR): to select function, four 16-bit registers
Function code: 0xA for input capture (IC), 0x4 for output compare (OC)
Parameter memory format for an IC channel

4

```
Related docs
Other docs by huangyuarong
06-15-10TimeLapse
Views: 2  |  Downloads: 0
06-08-10TimeLapse
Views: 1  |  Downloads: 0
Haz clic aquí para ver la presentación en
Views: 40  |  Downloads: 0
He has - MFL Resources
Views: 2  |  Downloads: 0
Grey Water Recycling
Views: 1  |  Downloads: 0
04_15_Mojica
Views: 1  |  Downloads: 0