Your excitement and pure joy make these videos so enjoyable! Love the book but I also find I learn better with the video and commentary. Amazing work, thank you for making these.
@yugsharma97073 жыл бұрын
I am using 2 switches on P3.3 and P3.4 port How can I write ISRs for same port like PORT 3?
@shivamkhamble2 жыл бұрын
I know it's a bit too late. But if you're still interested, you can detect and handle multiple interrupts on the same port independently by checking the specific bit in the P3IFG register. So even though both your switches are linked to the same interrupt vector (i.e PORT3_VECTOR), you can set up conditionals inside your ISR to check which switch triggered the interrupt. So here's how it would look like #pragma vector=PORT3_VECTOR __interrupt void PORT3_ISR (void) { if (P3IFG & BIT3) // Check whether P3.3 triggered the interrupt P1OUT ^= BIT0; // Desired action like toggling an LED connected to P1.0 if (P3IFG & BIT4) // Check whether P3.4 triggered the interrupt P1OUT ^= BIT1; // Desired action like toggling an LED connected to P1.1 P3IFG &= ~(BIT3 + BIT4); // Clear interrupt flag register P3IFG } Happy learning :)