Embedded Systems Programming Lab
1. How many wave generation modes are available for ATmega328? Name
them.
2. What is the relation between two adjacent notes in terms of
frequency ratio?
3. What is the standard pitch for the equal temperament?
4. What is the difference between CTC mode and Fast PWM in
AVR.
5. Write a function to calculate period for notes. (Take index as
an argument for the
function and calculate)
// Start here
Void calculate_period
{
}
1) Fast PWM, Phase Corrected PWM and Phase and Frequency Phase Corrected PWM are the different wave generation modes available in ATmega328.
2) for any two adjacent notes the frequency ratio is the same
3)An equal temperament is a a system of tuning, in which the frequency interval between every pair of adjacent notes has the same ratio. The standard pitch is usually 440 Hertz, called A 440.The piano keyboard is the standard example of the equal tempered scale
4)There are three timers in ATmega.
timer0:8 bit
timer1:16 bit
timer3:32 bit
these timers can be operated in normal(timer is cleared after it overflows) mode,CTC(timer is cleared after matching a specified value) and PWM mode
In AVR, PWM( Pulse Width Modulation is a technique by which width of a pulse is varied while keeping the frequency constant ) Mode is available in all timers TIMER0 and TIMER2 provide 8bit accuracy whereas TIMER1 provides 16bit accuracy. In 8bit accuracy, you have 256 individual steps, whereas in 16bit accuracy, you have 65536 steps.
A timer in CTC mode allows us to compare a value which lies in the middle of timer initialization value and timer overflow. When the value of timer and our desired value becomes equal, we can do an action for example turning off an LED
CTC timer interrupts are triggered when the counter reaches a specified value, stored in the compare match register. Once a timer counter reaches this value it will clear (reset to zero) on the next tick of the timer's clock, then it will continue to count up to the compare match value again. By choosing the compare match value and setting the speed at which the timer increments the counter, you can control the frequency of timer interrupts.
Embedded Systems Programming Lab 1. How many wave generation modes are available for ATmega328? Name them....
C Programming write two functions, similar to what you see in the sample program. The first will ask the user to enter some information (I have included the type in parentheses) First Name (char[]) Last Name (char[]) Age (int) Height in Inches (double) Weight in Pounds (double) You will use pass-by-reference to modify the values of the arguments passed in from the main(). Remember that arrays require no special notation, as they are passed by reference automatically, but the other...