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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!