Last active
October 2, 2019 17:12
-
-
Save jakabo27/d7f29d351b4462867f85664c3dc50aa3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void __ISR(3) JacobIsCool_Int1(void){ | |
//Read in values | |
//A rising edge | |
//CW 1 to 2 | |
//CCW 4 to 3 | |
//A falling edge | |
//CCW 2 to 1 | |
//CW 3 to 4 | |
//Keep count between 0 and 15 | |
//Write to LEDs | |
//Flip A polarity | |
//Reset flag | |
} | |
void __ISR(7) JamesIsACoolTA_Int0(void){ | |
//similar stuff | |
} | |
main(){ | |
//Set LED output pins to digital not analog | |
//Set LED output pins as output | |
//Startup sequence - turn on each light in order, then turn them off | |
LATB = 0; | |
LATBbits.LATB0 = 1; delay(250); | |
LATBbits.LATB1 = 1; delay(250); | |
LATBbits.LATB2 = 1; delay(250); | |
LATBbits.LATB3 = 1; delay(500); | |
LATB = 0; delay(100); | |
//Enable interrupts | |
//For interrupt 0 just use the built in one on pin 37 | |
//Remap interrupt 1 to pin C4(pin 33) | |
//Set input pins from rotary encoder | |
//Interrupt 0 - built in, on pin 37 (B7)) | |
//look for rising/falling edge based on where it currently is | |
//Interrupt 1 - remapped to pin 33 (C4)) | |
//Look for a rising or falling edge depending on what it currently reads | |
} | |
delay(int delayTime){ | |
int i, j; | |
for(i = 0; i < delayTime; i++) | |
for(j = 0; j < 312; j++); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment