I have my leds going in one direction and I need to have the
I have my leds going in one direction and I need to have them back from led 7 to led 0. I need that now . Thanks . I have my code written below . I did not finish
Instruction : If the lights initially flahed from LED 0 to LED 7 , depressing the switch once should switch the pattern to LED 7 to LED 0 . The pattern should reverse each time the switch is depressed .
#include \"EE3310_header.h\"
 #include \"EE3310_header.h\"
 #include <p24FJ64GA102.h>
 #include \"xc.h\"
 #define ON 1
 #define OFF 0
#define LED0 _RB3
 #define LED1 _RB4
 #define LED2 _RB5
 #define LED3 _RB6
 #define LED4 _RB7
 #define LED5 _RB8
 #define LED6 _RB9
 #define LED7 _RB10
 #define SW3 _RB15
void config_Timer3(void){
 T3CONbits.TON=0; //Turns TIMER off Initially
 PR3=62499;
 T3CONbits.TCKPS= 0b10; //Pre-scaler=256
 _T3IF=0; // Interrupt Flag state
 _T3IE=1; } //Enable Interrupt Bit
 void DELAY(int T){
 int DelayT=T; // Sets input time T to variable within Function to DelayT
 int j=0; // Sets counter variable to 0
 T3CONbits.TON=1; // Timer On
 _T3IF=0; // SETS The Timer Flag to 0
 for (j=0; j<DelayT; j++ ){ // Counter loop for DELAY T time[s]
 TMR3 = 0; //Sets the Timer Bit to 0;
 while(!_T3IF){} // Waits for the TIMER FLAG to turn high
 _T3IF=0;} //Resets timer flag to low
 T2CONbits.TON=0;} //Turns Timer off
 void config_io(void){
 TRISA = 0b00000;
 TRISB = 0x8000; //set RB 15 high, ALL OTHERS port b as outputs
 PORTA = 0b00000; // RA to low
 PORTB = 0x0000;
 AD1PCFG = 0x1FFF; //set analog pins to digital
   
 }
void Config_CN (void) {
 _CNIP = 3;
 _CNIF = 0;
 _CNIE = 1;
 _CN11IE = 1;
 }
 int main(void){
 int i = 0,a = 30;
 config_Timer3();
 config_io();
 while(1)}
void __attribute__((__interrupt__,no_auto_psv)) _T1Interrupt (void){
 if(SW3 == 1);{
 LED0 = ON;
 DELAY(a);
   
 LED0 = OFF;
 LED1 = ON;
 DELAY(a);
   
   
 LED1 = OFF;
 LED2 = ON;
 DELAY (a);
 
 LED2= OFF;
 LED3= ON;
 DELAY (a);
   
 LED3=OFF;
 LED4=ON;
 DELAY (a);
   
 LED4=OFF;
 LED5=ON;
 DELAY (a);
   
 LED5=OFF;
 LED6=ON;
 DELAY (a);
 
 LED6=OFF;
 LED7=ON;
 DELAY(a);
   
 LED7 = ON;
 DELAY(a);
   
   
   
 }
 
 }
 return 0 ;
   
   
Solution
5 leds
6 leds


