Question: Exercise: Toggle the two PORTA LSB bits ( D 2 & D 3 ) if the switch S 1 connected to RB 4 is ON;

Exercise: Toggle the two PORTA LSB bits (D2 & D3) if the switch S1 connected to
RB4 is ON; else, toggle the two MSB bits (D4 & D5). Use TMR0 library function
to generate the time delay.
1. Check the configuration setting is correct in System Module.
2. Generate the code.
3. Click main.c and modify the code in the main program space to interact
with the input.
4. Build and download the code to the curiosity board and test the
function.
You will interact with the input by using Getvalue. Partial code below
#include "mcc_generated_files/mcc.h"
void myISR(void);
volatile int currentIndex;
void main(void)
School of Engineering LJMU
Embedded Lab 2 Exercises
{
// initialize the device
SYSTEM_Initialize();
// Enable the Global Interrupts
INTERRUPT_GlobalInterruptEnable();
// Enable the Peripheral Interrupts
INTERRUPT_PeripheralInterruptEnable();
TMR1_SetInterruptHandler(myISR);
while (1)
{
// Add your application code
if(IN1_GetValue()==0){
.
.
.
}

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!