I can’t get my PIC to recognise any interrupt. I have 4 switches on Port B and although they can be read easily with an input command, if I use an interrupt to call a macro to execute this input command then nothing happens when any button is pressed. So it is not reacting to the interrupt. Have tried both upper nibble and B0 interrupts. (Flowcode simulation works fine.)
What am I doing wrong?
1) Is it an error in the 16F886.FCD file? Please Ben can you try it on your 887 to check, assuming any error woudl also be in the 887 file? You have my code for this.
2) Have I put the interrupt command in wrong place? It’s at beginning of flowchart and I assume that wherever the code is at the time that the interrupt will always stop the program and jump to the above macro. Is that right?
3) Does an interupt need a special hardware circuit to trgger it? I am using a push button to 5V via 220 ohm resistor. with pulldown to 0V. It switches from 5 to 0V OK as measured by voltmeter.
Interrupt not working
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Hello Echase
Yes I think I have found the problem. Try adding a C code statement straight after you enable the interrupts with the following C code.
This enables all of the portB pins to interrupt on change. If you want to change which pins can trigger the interrupt then you can change the hex value going into the icob register.
Yes I think I have found the problem. Try adding a C code statement straight after you enable the interrupts with the following C code.
Code: Select all
iocb = 0xff;
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Great. Does that work with upper nibble B port change? Don't want it to react to lower nibble as that is connected to some LED outputs (or maybe, as these only light when set to outputs, the interrupt on input would not trigger). I have masked off the lower nibble in the Input command.
Slightly worrying that certain bits of Flowcode like OSCCON and this don't work without extra lines of C code being added. Is it something you correct in future releases or is it because Flowcode can’t cover all PIC varieties without some C lines being added?
Slightly worrying that certain bits of Flowcode like OSCCON and this don't work without extra lines of C code being added. Is it something you correct in future releases or is it because Flowcode can’t cover all PIC varieties without some C lines being added?
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Hello
Flowcode can cover all varieties of PICmicros but there are still a few bugs present in our FCD files.
I will be editing the FCD files for the 886 and family to correct this problem.
To just allow interrupts of the high nibble of PortB you use the following C command.
Flowcode can cover all varieties of PICmicros but there are still a few bugs present in our FCD files.
I will be editing the FCD files for the 886 and family to correct this problem.
To just allow interrupts of the high nibble of PortB you use the following C command.
Code: Select all
iocb = 0xf0;
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Hello echase
yes it looks like the C command is still required to mask off the low nibble.
yes it looks like the C command is still required to mask off the low nibble.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Sorry I was wrong.
This was something that we changed a while ago. With the latest FCD you should get the option to select properties when using the port change interrupt. This will allow you to mask off the pins you want to trigger the interrupt.
This was something that we changed a while ago. With the latest FCD you should get the option to select properties when using the port change interrupt. This will allow you to mask off the pins you want to trigger the interrupt.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel