![]() |
Forum Index : Microcontroller and PC projects : Maximum number of interrupts?
Author | Message | ||||
Bizzie Senior Member ![]() Joined: 06/07/2014 Location: AustraliaPosts: 192 |
Am I correct in thinking that the CGCOLORMAX2 from CircuitGizmo has the most "pin" interrupts of all the mites so far? I need a system where I can monitor 10 lots of 4 (only 1 of the 4 will be closed at anyone time) digital inputs from reed switches. Rather than rely on the speed that you can loop through these I would like to use interrupts but I do not know of a mite which will give me 40 and still use I2C. Also is there anyway to know which pin generated the interrupt other than checking each pin with the pin(x) function? Rob White |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2447 |
i believe there is no other way apart from checking each pin. the only other solution offered by others in the past was to have a separate interrupt handler assigned to each pin. i do recall suggesting (during micromite beta testing) that the pin number should be accessible to the handler in some way, but was roundly outvoted by other forum members. if it is essential to capture every single event, your safest approach is to use a hardware solution consisting of 40 latches that your micromite or maximite can then sit there polling. if using micromites, there is no reason you can't have several working together. cheers, rob :-) |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10400 |
The pin interrupts aren't true hardware interrupts, the pins are actually polled between the execution of each Basic command or in a continuous loop in a PAUSE statement. Given this there isn't too much advantage to using the interrupts rather than polling in your program. If you use the PORT function you can check up to 23 inputs at once. |
||||
BobD![]() Guru ![]() Joined: 07/12/2011 Location: AustraliaPosts: 935 |
You may find a solution in this document . Also see this link . |
||||
MicroBlocks![]() Guru ![]() Joined: 12/05/2012 Location: ThailandPosts: 2209 |
Have a look at one of these. These are I/O port expanders and are available in I2C and SPI versions. They can be configured for input or output and can also generate an interrupt. With I2C you can use up to 8 of them giving you a maximum of 128 i/o ports. A lot cheaper then using uMites or other mcu's. The aded benefit is that they are also 5.5v tolerant and give you a separation between the switches and the mcu. When configured to use interrupts a register will capture which pin it was so that even when the pin returns to its previous state the information is still available. Also available in DIP for easy bread boarding. Microblocks. Build with logic. |
||||
Bizzie Senior Member ![]() Joined: 06/07/2014 Location: AustraliaPosts: 192 |
Thanks to you all for your very useful answers. Am annoyed with myself about not thinking of the PORT() command/function! Looks like I should not get too overwhelmed with all the available pins and go back to how I would of handled this in the past - multiplexing! but with BobD's I2C suggestion. Thanks again Rob Rob White |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |