Add Interrupt pins to Teensy 2.0

Status
Not open for further replies.

zachtos

Well-known member
I'm in need of more interrupts on the Teensy 2.0. I see in the manual that there are 13 external interrupts available portD0:3, portE6, portC0:7 . Is there a way to reconfigure them in Teensyduino to be capable of interrupt instead of just digital input/output?
 
Those are the "pin change" interrupts.

Teensyduino and Arduino do not directly support them with functions like attachInterrupt. But like all hardware features, you can access directly. The one good example would be the SoftwareSerial library, which uses the pin change interrupt to detect the beginning of an incoming byte.

The resisters are documented in the Atmel datasheet, so that can help you understand the code. Ultimately, you're working directly with the hardware, so it's a bit of a blank slate where you're on your own to figure out the details. Starting with the SoftwareSerial source can at least give you an example of how Mikal Hart did it.
 
Thanks, I may be able to just move the bluetooth over to software serial instead of hardware serial, that would free up the other 2 interrupts. I just don't know how reliable softserial really is or the fasted baud I can get away with reliably.
 
Status
Not open for further replies.
Back
Top