Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C program for the A T 9 0 that uses the input captures system of the 1 6 - bit timer / counter

Write a C program for the AT90 that uses the input captures system of the 16-bit
timer/counter to measure the frequency at pin ICP1(=PD4).
Pin PD4 is connected to a PWM frequency generator of the lab board. The generator has 16
settings that differ in frequency (up to 400kHz) and duty cycle. Button "FREQ SEL" allows you
to change between settings. The current setting is displayed as a hexadecimal number on the
component labelled "FRQ".
Example settings:
Setting 0= off
Setting 1=1Hz wave
o Setting 5=1kHz wave
The frequency is measured using the "frequency method" from the lecture: Over a certain
measurement duration d, the number e of rising edges are counted.
The frequency f is displayed in Hz as an 8-bit value on the LED panel (Port C).
To account for frequencies that exceed the 8-bit range, the switches on Port A can be used to
change the unit (e.g. to 0.1Hz,1Hz,100Hz).
Values higher than 255 are displayed as 255. Hence, a value of 255 indicates that the
switches should be used to change to another unit.
More specifically, the switches effect the
measurement duration d,
timer/counter prescaler, and
a multiplier for the displayed value f
as follows:
Switch PA7 switches between a 'configuration mode' and a 'measurement mode'.
In the 'measurement mode', the white lamp (PB6) is turned on to indicate ongoing
measurements. Measurements are being taken repeatedly until PA7 is turned to
'configuration mode'. Whenever the frequency measurement is updated, the value is
displayed on Port C.
In the 'configuration mode', the white light is off and no frequency measurements
are conducted. Instead, the user can configure the measurement process via
switches PA0, PA1, PA2, PA3. The LEDs on PC0, PC1, PC2, PC3 light up according to
the switch positions.
If PA0= off, then a prescaler of 8 is set (resulting in timer/counter increments every 1us).
If PA0= on, then a prescaler of 1 is set (resulting in timer/counter increments every 125ns).
PA2 and PA1 set the measurement duration as follows:
PA2= off, PA1= off d=10 measurement duration
PA2= on, PA1= off d=1 s measurement duration
PA2= on,PA1= on d=10 ms measurement duration
To handle very high frequencies, PA3= on allows to divide the number of rising edges e
detected over the measurement duration to be divided by 100 before being displayed.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 19th International Conference Dexa 2008 Turin Italy September 2008 Proceedings Lncs 5181

Authors: Sourav S. Bhowmick ,Josef Kung ,Roland Wagner

2008th Edition

3540856536, 978-3540856535

More Books

Students also viewed these Databases questions

Question

4. How has e-commerce affected business-to-business transactions?

Answered: 1 week ago