Explorer 16 will be used.
Question 1.
To set up the interrupt mechanism for Timer1, mention the name of the specific registers and the specific bits that need to be configured.
Question 2.
The primary oscillator is used as the clock source and its frequency is 7.648 GHz. The PLL is used. In that case, what is Fcy (Internal instruction cycle frequency)? Also, what is Tcy? You must show your calculation. Failing to do so will result zero mark for this question.
Question 3.
We want to send a character B (ASCII CODE 42H) through UART2 with 1 stop bit and using odd parity.
Q1. Write the packet. (3 Marks)
Q2. If baud rate is 9600, then, to transmit this packet, UART2 will take how much time? (3 Marks)
Question 4.
In Project#2, you are using TMR1 of Explorer 16 board. Say, we are going to use TMR1 to generate interrupt (with priority 5) at 200uSec interval. We will be using Tcy as the clock source for TMR1 with a Prescaler value of 1:8. Write an TMR1Init() to configure all the related registers for TMR1.
1 answer
To set up the interrupt mechanism for Timer1, the specific registers that need to be configured are:
- T1CON (Timer1 Control Register)
- TMR1IE (Timer1 Interrupt Enable bit) in IEC0 (Interrupt Enable Control Register 0)
- TMR1IP (Timer1 Interrupt Priority bit) in IPC0 (Interrupt Priority Control Register 0)
- PR1 (Timer1 Period Register)
The specific bits that need to be configured are:
- Set T1CON.TON bit to enable Timer1
- Set T1CON.TCS bit to select the internal clock source for Timer1
- Set T1CON.TCKPS bits to configure the prescaler value for Timer1
- Set T1CON.TSIDL bit to continue Timer1 operation during idle mode if required
- Set TMR1IE bit in IEC0 to enable Timer1 interrupt
- Set TMR1IP bit in IPC0 to set the interrupt priority level for Timer1
- Configure the value in PR1 to set the period of Timer1 interrupt
Question 2.
To calculate Fcy (Internal instruction cycle frequency) and Tcy, we need to know the PLL multiplier used. Please provide the PLL multiplier value.
Question 3:
Q1. The packet to send the character B (ASCII CODE 42H) through UART2 with 1 stop bit and odd parity is:
Start bit (0) - Data bits (01000010) - Parity bit (O) - Stop bit (1)
Q2. To calculate the time taken to transmit this packet with a baud rate of 9600, we need to know the number of bits in the packet.