8-bit or 16-bit mode, and the prescaling ratio. You can assume XTAL = 10M Hz or at the frequency you specify.
-
Write a C program to generate a frequency of
-
200 Hz on PORTA pin 3. You do not have to write all the code, just specify which example(s) of the Mazidi book you modify from, with the page number. Show the new contents of Timer configuration register, Timer High (say TMR0H), Timer Low register if applicable. Also show how you calculate. (in other words, the original code may have T0CON = 0x0; and your new code may have T0CON = 0x88; the original code may show TMR0H = 0xFF; and your new code may show TMR0H = 0x ED; Explain and showhow you derive these)
-
200 Hz on PORTA pin 3 when a switch SW = 0 and 400 Hz on PORTA pin 4 when SW = 1 for the same switch. Assume this switch SW connects to PORTA pin 0. The code of part (b) can come from (a) with suitable modification.
-
With 2 switches SW1 and SW2:
200 Hz on PORTA pin 3 when SW1 = 0, SW2= 0;
400 Hz on PORTA pin 4 when SW1 = 1, SW2 = 0;
800 HZ on PORTA pin 5 when SW1 = 0, SW2 = 1; and
1600 HZ on PORTA pin 6 when SW1 = 1, SW2 = 1.
Here SW1 is connected to PORTA pin 0 and SW2 is connected to PORTA pin1.
-
Write a C program with a 200 Hz external clock fed into pin T1CKI (not T0CKI) to display the seconds and minutes on PORTB and PORTD. You can pick your timer as in 8 bit or 16 bit mode. Show which example can be modified from and how the code is modified.