Interrupt Flags and Setint NOT ?

manie

Senior Member
Chips are 40x1 and a 28x1 both with Hserin/Hserout and Setintflags to detect data flowing between them. The 40x1 updates the 28x1 for LCD display via the Firmware chip, and the 28x1 updates the 40x1 with new parameter settings. This works just fine both ways.

Question: With the Setintflags active, how can I do another interrupt to check 4 limit switches on the 40x1. Limit switches can go high or low whicever will work. I have for input pins dedicated to the four limit switches.

Currently I check the status of the switches BEFORE starting one of two motors. The limit switches are FINAL protection against over run and should get the motors to stop immediately. Help please....
 

MFB

Senior Member
There will be nothing very ‘final’ about routing the limit switches through a microcontroller. A higher level of protection will be achieved by placing the limit switches directly in-line with the motor supplies.
 

hippy

Ex-Staff (retired)
Once you've configured and enabled interrupts any interrupt activation will jump the program to the "interrupt:" routine. Within it you will need to determine what caused the interrupt and handle all interrupts appropriately.
 

BeanieBots

Moderator
Manie, MFB is right. "Limit" switches should activate a hardware stop.

What can cause a limit switch to be activated?
A software error?
A micro crash?

IF the software was perfect and the micro could never crash, why would you need a limit switch?
 

manie

Senior Member
Let's not talk limit switches please. The question was regarding Interrupts. I have the Setintflags command active already. Can I still have an interrupt from those limit switches ? Thanks
 

hippy

Ex-Staff (retired)
Yes; SetIntFlags and SetInt can both be used together, either can generate an interrupt.
 

manie

Senior Member
Hippy,BB,MFD : Thanks for the input guys, it is still appreciated. The term "limit" switch should read "5V Input Signal" switch. I use them to indicate top/bottom end positions.

These are reed switches, the magnetically activated square white door security type, and current capability will be limited. I doubt they would be able to carry even the 100-150 mA for a relay (or could they ?). I opened one and looked inside, the reed glass tube is really tiny.

But I really appreciate your contribution, this is what I'm stuck with now (Sunday out in the country-side, no chance of replacements. If need be I'll postpone the "BIG switch-on" for the chook-house and get proper switches to also interrupt the relay 12V feed...

Edit:
Question again. I'm trying to implement the chook-house controller, as it is 400kM to get here I'm eager to get it done this weekend, so PLEASE indulge....
The above interrupts (for various reasons), occur on Port C inputs 0,1,2,3 (where else ??). The manual says on "input" pins, I suppose this means the DEDICATED input port on the 40x1 ? Oram I in luck here maybe ??
 
Last edited:

manie

Senior Member
No problem, I could swap to normal input pins 0,1. As only one switch of each pair could be high at once, I've combined the inputs from a pair onto one input pin. Now I can do a "setint NOT %00000000,%00000011" and either can trigger the interrupt.

Thanks again
 

Technical

Technical Support
Staff member
Yes; SetIntFlags and SetInt can both be used together, either can generate an interrupt.
Correction, only one (the latest to be set) will actually be 'active' at any one time.

So if you have a 'setint' already active and then issue a new 'setintflags', the original setint is no longer active.
 
Top