Question: For the timer configuration we are using the pic24FJ64GA102 . We are using MPLAbxide for programming. It's like c language Write code do to the
For the timer configuration we are using the pic24FJ64GA102 . We are using MPLAbxide for programming. It's like c language
Write code do to the following

The code must use interupts but can be done on timer(s) that will do the assignment which for the code must include the following:
#include "xc.h"
#include "../Config3310.h"
#include
// Define Statements
#define LED0 _LATB4
#define LED1 _LATB5
#define LED2 _LATB6
#define LED3 _LATB7
#define LED4 _LATB8
#define LED5 _LATB9
#define LED6 _LATB10
#define LED7 _LATB11
#define SW1 _RA4
// Config Functions
void Config_IO(void) {
TRISA = 0b10000;
TRISB = 0x0000;
PORTA = 0b00000;
PORTB = 0x0000;
ANSELA = 0b00000;
}
The next is an example dealing with timers and interupts that also use the p33EP128GP502 and is not the actual code that you can look at for an idea of what's going on
#include "xc.h"
#include "../Config3310.h"
#include
// Define Statements
#define LED0 _LATB4
#define LED1 _LATB5
#define LED2 _LATB6
#define LED3 _LATB7
#define LED4 _LATB8
#define LED5 _LATB9
#define LED6 _LATB10
#define LED7 _LATB11
#define SW1 _RA4
// Config Functions
void Config_IO(void) {
TRISA = 0b10000;
TRISB = 0x0000;
PORTA = 0b00000;
PORTB = 0x0000;
ANSELA = 0b00000;
}
void Config_T1(void) {
T1CONbits.TON = 0;
T1CONbits.TCKPS = 0b10;
PR1 = 28788;
_T1IP = 3;
_T1IF = 0;
_T1IE = 1;
}
void Config_T2(void) {
T2CONbits.TON = 0;
T2CONbits.TCKPS = 0b01;
T2CONbits.T32 = 0;
T2CONbits.TCS = 0;
PR2 = 46062;
_T2IP = 2;
_T2IF = 0;
_T2IE = 1;
}
void Config_T3(void) {
T3CONbits.TON = 0;
T3CONbits.TCKPS = 0b11;
T3CONbits.TCS = 0;
PR3 = 43183;
_T3IP = 4;
_T3IF = 0;
_T3IE = 1;
}
void Config_CN (void) {
_CNIP = 5;
_CNIF = 0; //
_CNIEA4 = 1; //
_CNIE = 1;
}
// Interrupts
void __attribute__((__interrupt__, no_auto_psv)) _T1Interrupt(void) { /o_auto_psv is not going to save it in permantant memory
TMR1 = 0;
LED6 = !LED6;
LED7 = !LED7;
_T1IF = 0;
} // end T1Interrupt
void __attribute__((__interrupt__, no_auto_psv)) _T2Interrupt(void) {
TMR2 = 0;
LED5 = !LED5;
LED8 = !LED8;
_T2IF = 0;
} // end T2Interrupt
void __attribute__((__interrupt__, no_auto_psv)) _T3Interrupt(void) {
T3CONbits.TON = 0;
TMR3 = 0;
LED1 = 0;
_T3IF = 0;
} // end T3Interrupt
void __attribute__((__interrupt__, no_auto_psv)) _CNInterrupt(void) {
if (SW1 == 0){
// if (SW1 == 1){
TMR3 = 0;
T3CONbits.TON = 1;
LED1 = 1;
}
_CNIF = 0;
} // end CNInterrupt
int main(void) {
Config_IO ();
Config_T1 ();
Config_T2 ();
Config_T3 ();
Config_CN ();
LED5 = 1;
LED6 = 1;
LED7 = 0;
LED8 = 0;
T1CONbits.TON = 1;
T2CONbits.TON = 1;
T3CONbits.TON = 1;
while (1) {
}
return 0;
}
Purpose: The purpose of this lab is to create a project that mimics the Approach Lights to an airport runway. Approach lights are a series of lights that flash quickly in sequence to lead an aircraft to a runway, usually under Instrument Flight Rules when visibility is poor due to rain, fog, or other phenomena. Assignment: 1. Create a simulation of the Approach Light system (just the string of flashing lights) using 8 LEDs. Yes, 8. The Lab 2 only required 7) 2. Add a pushbutton switch the causes the lights to flash in the opposite direction-if the lights initially flashed from LEDO to LED7, depressing the switch once should switch the pattern to LED7 to LEDO. The pattern should reverse each time the switch is depressed
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
