Question
Briefly describe the idea how this program should be modified if we want to display the counts for the PP1 external interrupt and RTI interrupt
Briefly describe the idea how this program should be modified if we want to display the counts for the PP1 external interrupt and RTI interrupt on the LCD. What global variables and functions you would want to add/modify in the program? (This is for the TWR-EDU-KIT)
Code:
// Week 2 Lab, part C
// Your name
// Date accomplished
// Course number
// This is a demonstration of RTI interrupt combined with Port P interrupt
// The RTI clock is default to internal oscillator running at 1 MHz.
// Writing 0x7f to CPUMRTI sets the clock divider to 16 x 2^16 = 1,048,576.
// Use a SPST switch between PP1 (Peripheral board connector pin 17) and GND (pin 31)
// Pressing the switch will result in an interrupt
#include
#include "derivative.h"
/******* Global Variables *******/
unsigned charcCount;
unsigned chardata2;
/******* main *******/
void main(void)
DDRT = 0xF0;
DDRP = 0x00;
PPSP = 0x00;
PERP = 0xFF;
PIFP = 0x02;
PIEP = 0x02;
CPMURTI = 0x7f;
CPMUINT_RTIE = 1;
cCount = 0xC0;
EnableInterrupts;
PTT = cCount + data2;
/******* Interrupt Service Routine ********/
#pragma CODE_SEG NON_BANKED
interrupt ( ( (0x10000 - 0xFF8E) / 2 ) - 1 ) void PP1_ISR(void)
{
PIFP = 0x02;
if(data2<0xE0) data2 = data2 + 0x80;
else data2 = 0;
#pragma CODE_SEG DEFAULT
#pragma CODE_SEG NON_BANKED
interrupt ( ( (0x10000 - 0xFFF0) / 2 ) - 1 )void RTI_ISR(void)
CPMUFLG_RTIF = 1;
#pragma CODE_SEG DEFAULT
/********** End of Program file **********/
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started