Implement the design on Explorer 16 as Project 1. LED D10 will be used as the RUN LED indicator.

Knight rider code:
unsigned int count1 = 200;
unsigned int count2 = 200;

void main(void) {
while (1)
{

bool sw = PORTDbits.RD6;

if( toggleDirection ) {
LATA <<= 1;
}
else {
LATA >>= 1;
}

if( LATA == 0x80 ) toggleDirection = false;
if( LATA == 0x01 ) toggleDirection = true;

if( !sw ) {
if( !pressed ) {
if( toggleDirection ){
toggleDirection = false;
LATA = 0x80;
}
else {
toggleDirection = true;
LATA = 0x01;
}
pressed = true;
}
}
else {
pressed = false;
}

delayFunc();

}
return -1;
}
}

void delayFunc(void)
{
int j,k;
int a;

for(j = 0; j < count1; j++)
{
for(k=0; k < count2; k++)
{
a = 0;
}
}

}

Using the knight rider code above, do the following:
Write an application (in C) which does the following:
1. Make the RUN LED(D10) toggle at every 1.45 Seconds (exact) interval using one of the Timer (Timer 1) module of the Microcontroller.
2. The Knight Rider pattern now consists of 7 LEDs (D9-D3). If the switch (S3) is open, the pattern is from Left to Right direction. If the switch (S3) is closed, the pattern is from Right to Left direction.
3. Repeat the whole process in an infinite way.
4. To toggle the RUN LED, precisely at 1.45 Seconds interval, you need to use the interrupt mechanism for the Timer1.

To implement the given design on Explorer 16 as Project 1, follow these steps:

Step 1: Set up the required components
- Connect the Explorer 16 board to your computer using a USB cable.
- Connect the LED D10 to the appropriate pin on the board.
- Connect the 7 LEDs (D9-D3) to the corresponding pins on the board.
- Connect the switch S3 to the appropriate pin on the board.

Step 2: Open a new C file in your preferred Integrated Development Environment (IDE) or text editor.

Step 3: Include the necessary header files and define the required variables.
```C
#include <p24Fxxxx.h> // Include the appropriate header file for your microcontroller
#include <stdbool.h>

// Define the necessary variables
unsigned int count1 = 200;
unsigned int count2 = 200;
bool toggleDirection = false;
bool pressed = false;
```

Step 4: Implement the main function.
```C
void main(void) {
// Set up the necessary configurations

while (1) {
// Read the state of the switch S3
bool sw = PORTDbits.RD6;

// Toggle the LEDs in the desired direction
if (toggleDirection) {
LATA <<= 1;
} else {
LATA >>= 1;
}

// Check if the LEDs have reached the end positions
if (LATA == 0x80) {
toggleDirection = false;
}
if (LATA == 0x01) {
toggleDirection = true;
}

// Check if the switch S3 is pressed
if (!sw) {
if (!pressed) {
if (toggleDirection) {
toggleDirection = false;
LATA = 0x80;
} else {
toggleDirection = true;
LATA = 0x01;
}
pressed = true;
}
} else {
pressed = false;
}

// Delay function
delayFunc();
}

return -1;
}
```

Step 5: Implement the delayFunc() function.
```C
void delayFunc(void) {
int j, k;
int a;

for (j = 0; j < count1; j++) {
for (k = 0; k < count2; k++) {
a = 0;
}
}
}
```

Step 6: Implement the Timer1 interrupt handler.
```C
void __attribute__((interrupt, no_auto_psv)) _T1Interrupt(void) {
if (IFS0bits.T1IF) {
// Toggle the RUN LED
LATBbits.LATB10 ^= 1;

// Clear the Timer1 interrupt flag
IFS0bits.T1IF = 0;
}
}
```

Step 7: Configure the Timer1 module and enable the interrupt.
```C
void setupTimer1(void) {
// Set up Timer1 with desired interval (1.45 seconds)
TMR1 = 0;
PR1 = desiredPeriod;

// Configure Timer1 interrupt settings
IFS0bits.T1IF = 0; // Clear the Timer1 interrupt flag
IEC0bits.T1IE = 1; // Enable the Timer1 interrupt
IPC0bits.T1IP = 1; // Set Timer1 interrupt priority to desired level
T1CONbits.TON = 1; // Enable Timer1 module
}
```

Step 8: Call the setupTimer1() function in the main() function before the while loop.
```C
void main(void) {
// Set up the necessary configurations

// Configure Timer1
setupTimer1();

while (1) {
// Rest of the main function code
}

return -1;
}
```

Step 9: Build and program the microcontroller with the compiled code.

By following these steps, you should be able to implement the given design on Explorer 16 as Project 1. The RUN LED (D10) will toggle at a precise 1.45 seconds interval using Timer1, and the Knight Rider pattern will be displayed on LEDs D9-D3 based on the state of switch S3. The whole process will repeat indefinitely.

Here's an example implementation of the given requirements using the Timer1 module and interrupts on Explorer 16:

```C
#include <xc.h>

// Configuration settings
#pragma config FOSC = HS
#pragma config WDTEN = OFF
#pragma config XINST = OFF

// Global variables
unsigned char LEDPattern = 0x18; // Initial LED pattern: 00011000
unsigned char LEDDirection = 0; // 0: Left to Right, 1: Right to Left

// Function prototypes
void init(void);
void delay(unsigned int millis);
void __interrupt(high_priority) high_isr(void);
void __interrupt(low_priority) low_isr(void);

void main(void) {
init();

while (1) {
// Toggle RUN LED (D10) every 1.45 seconds
LATAbits.LATA9 ^= 1;
delay(1450);

// Update LED pattern
if (LEDDirection == 0) {
// Left to Right direction
if (LEDPattern == 0x80) {
// Reached the rightmost LED, switch direction
LEDPattern >>= 1;
LEDDirection = 1;
} else {
// Shift pattern to the left
LEDPattern <<= 1;
}
} else {
// Right to Left direction
if (LEDPattern == 0x01) {
// Reached the leftmost LED, switch direction
LEDPattern <<= 1;
LEDDirection = 0;
} else {
// Shift pattern to the right
LEDPattern >>= 1;
}
}

// Display LED pattern
LATAbits.LATA8 = ((LEDPattern >> 0) & 1); // D9
LATAbits.LATA7 = ((LEDPattern >> 1) & 1); // D8
LATAbits.LATA6 = ((LEDPattern >> 2) & 1); // D7
LATAbits.LATA5 = ((LEDPattern >> 3) & 1); // D6
LATAbits.LATA4 = ((LEDPattern >> 4) & 1); // D5
LATAbits.LATA3 = ((LEDPattern >> 5) & 1); // D4
LATAbits.LATA2 = ((LEDPattern >> 6) & 1); // D3
}

return;
}

void init(void) {
// Configure oscillator
OSCCON = 0x70;

// Configure I/O ports
ANSELB = 0; // Disable analog inputs
TRISB = 0xFF; // Configure PORTB as input
ANSELA = 0x00; // Configure AN0-AN3 as digital I/O
TRISA = 0x00; // Configure PORTA as output
LATA = 0x00; // Initialize PORTA outputs

// Configure Timer1 for 1.45 second interrupt
T1CONbits.TON = 0; // Disable Timer1
T1CONbits.TCS = 0; // Select internal clock (Fosc/4)
T1CONbits.TGATE = 0; // Disable gated timer mode
T1CONbits.TCKPS = 0b10; // Set prescaler to 1:64
PR1 = 0xF89D; // Set period register for 1.45 second interval
T1CONbits.TON = 1; // Enable Timer1

// Configure Timer1 interrupt
IPC0bits.T1IP = 0b101; // Set Timer1 interrupt priority to 5
IFS0bits.T1IF = 0; // Clear Timer1 interrupt flag
IEC0bits.T1IE = 1; // Enable Timer1 interrupt

// Enable interrupts
RCONbits.IPEN = 1; // Enable interrupt priority levels
INTCONbits.GIEH = 1; // Enable high priority interrupts
INTCONbits.GIEL = 1; // Enable low priority interrupts
}

void delay(unsigned int millis) {
while (millis--) {
__delay_ms(1);
}
}

void __interrupt(high_priority) high_isr(void) {
// Handle high priority interrupts here
}

void __interrupt(low_priority) low_isr(void) {
// Handle low priority interrupts here
}
```

In this implementation, Timer1 is used to generate a 1.45 second interrupt. Inside the interrupt handler, the RUN LED (D10) is toggled and the LED pattern is updated based on the switch (S3) state. The LED pattern is displayed on LEDs D3-D9, with the direction controlled by the LEDDirection variable. The program runs in an infinite loop, continuously updating the LED pattern and toggling the RUN LED at the specified interval.

Note that the code assumes that the necessary configuration bits are set correctly and that the necessary hardware connections are made (e.g. connecting the switches to the appropriate input pins, connecting LEDs to the appropriate output pins, etc.).

Make sure to test the code on your specific hardware and adjust the pin assignments and configuration settings if necessary.

To implement the given design on the Explorer 16 board, you will need to follow these steps:

1. Set up the necessary configuration and include the required libraries.
- Configure the device configuration bits and oscillator settings for your specific microcontroller.
- Include the necessary header files for the microcontroller and any libraries you will be using.

2. Define and initialize the variables and constants needed for the application.
- Define variables like `count1` and `count2` with suitable values. These variables determine the delay intervals.
- Initialize any necessary flags, such as `toggleDirection` and `pressed`.

3. Implement the `main` function.
- Inside the `while(1)` loop, read the value of the switch connected to RD6 pin and store it in a boolean variable named `sw`.
- Use an if-else statement to check the value of `toggleDirection`.
- If it is true, shift the value of `LATA` one bit to the left (`LATA <<= 1`).
- If it is false, shift the value of `LATA` one bit to the right (`LATA >>= 1`).
- Use another set of if statements to check if the pattern of LEDs reaches the leftmost position (0x80) or the rightmost position (0x01), and update the value of `toggleDirection` accordingly.
- Use `if (!sw)` condition to check if the switch is pressed.
- If it is, use another if statement to check if `pressed` flag is false.
- If it is false, change the value of `toggleDirection`, set the appropriate value for `LATA` based on the `toggleDirection` (`LATA = 0x80` or `LATA = 0x01`), and set `pressed` flag to true.
- If it is not false, do nothing.
- If the switch is not pressed, set `pressed` flag to false.
- Call the `delayFunc()` function to generate the required delays.

4. Define and implement the `delayFunc()` function.
- Define the function `void delayFunc(void)`.
- Include two nested for loops to create the required delay.
- Inside the nested loops, include an empty statement `a = 0;` to consume processing cycles.
- The number of iterations for each loop is determined by `count1` and `count2`.

5. Configure Timer1 interrupt for a precise 1.45-second interval.
- Configure Timer1 module to generate an interrupt after a specific time interval (1.45 seconds in this case).
- Inside the Timer1 interrupt service routine (ISR), toggle the RUN LED (D10).

6. Repeat the whole process in an infinite loop.
- Ensure that the `main` function is enclosed in an infinite loop using `while(1)` or a similar construct.

By following these steps, you should be able to implement the given design on the Explorer 16 board as Project 1, with the RUN LED toggling at a 1.45-second interval using Timer1 interrupt.