Write an assembly program to read from USART of PIC18F458, which is connected to a virtual terminal and a push button SW, as shown in Figure 2. When the push button SW is pressed, the PIC18 reads the string of characters from the virtual terminal via USART receiver and stores each character received into file registers starting at 0x100. The string follows the 8-bit data format and is terminated by the carriage return character, CR.
Figure 2: Schematic diagram for Question 2. Use the following pseudo-code to implement your programming in the main program.
i. Configure file select register FSRO
ii. Configure the push button SW as a high priority interrupt
iii. Enable interrupt
In the INTO interrupt service routine (ISR):
i. Configure the USART for asynchronous reception with a high-speed baud rate of 9600. Assume the crystal oscillator frequency of the PIC18 is 16 MHz.
ii. Enable USART for reception. You may ignore all framing and overrun errors.
In the USART RC interrupt service routine (ISR):
i. Read the data and save it to the buffer pointed by FSRO
ii. Check for the carriage return character, CR. If the data is not CR, exit the ISR. If the character CR is detected, terminate the buffer with a NULL character, disable USART, and disable RC interrupt. [16 Marks]