chipKIT® Development Platform

Inspired by Arduino™

Interrupt limitations help please

Created Thu, 08 Mar 2012 13:21:04 +0000 by les1943


les1943

Thu, 08 Mar 2012 13:21:04 +0000

I’m using a MCP23008 I2C port expander’s interrupt on change feature attached to UNO INT3 pin 8 it took some head-scratching to get expanders registers working but now I realise the ISR cannot call any device like ‘Serial’ that uses an interrupt am I correct ? I would have expected other interrupts to still be serviced ….


knChip

Mon, 19 Mar 2012 20:05:45 +0000

Did you try to clear the interrupt before using the Serial.print(" xxxxxx") in the ISR? ; so that further interrupts might get enabled.

It might not be a good idea to call Serial.print etc from ISR since print is a blocking function and will return only after all characters are send out. the better way might be to set some variable in the ISR and based on that veriable you could print from void loop() { }


les1943

Mon, 19 Mar 2012 20:20:05 +0000

KN , thanks for the reply , It had not occurred to me to clear the interrupt straight away ( my method with asm would be to have cleared the flag on exit of the isr.) I was testing out a 16 keypad and menu system using a serial LCD , the LCD function sat waiting for a ACK i presumed no interrupt from serial RX. went back to 3 buttons I may try again thanks. Les