Interrupt on port B in PIC16F88 nor work

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
maharadga
Posts: 71
Joined: Mon Dec 01, 2014 1:38 pm
Location: Bulgaria
Has thanked: 17 times
Been thanked: 12 times
Contact:

Interrupt on port B in PIC16F88 nor work

Post by maharadga »

Hello.
I try simple program with keypad and circullar buffer. I found that interrupt on port B not work in PIC16F88.
I'ts my mistake or bug in the program? I use latest FC8.
Attachments
Keylock-circullar buffer.fcfx
(12.53 KiB) Downloaded 136 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Interrupt on port B in PIC16F88 nor work

Post by medelec35 »

Hi maharadga ,
Hardware not working has nothing to do with portB interrupts.
The keypad works by sending a brief pulse into 1 column at a time, then if a pulse can be detected on a row e.g present on row 1,only if column 1 is pulsed then the key 1 must have been pressed.

The issue with your flowchart is you have got the keypad get component macro within port B IOC
The pulse for the keypad is ONLY sent when the keypad get componentis accessed.
As its never accessed, there is never a pulse for port B to detect.
Martin

maharadga
Posts: 71
Joined: Mon Dec 01, 2014 1:38 pm
Location: Bulgaria
Has thanked: 17 times
Been thanked: 12 times
Contact:

Re: Interrupt on port B in PIC16F88 nor work

Post by maharadga »

Yes,this is the reason.
Thank You. But if I change flowchart like attached /If call component keyboard and he send pulse/, it's no different.
Perhaps the reason is that the same port is busy with two activities.
Attachments
Keylock-circullar buffer.fcfx
(12.55 KiB) Downloaded 150 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Interrupt on port B in PIC16F88 nor work

Post by medelec35 »

Hi maharadga,
I have modified your flowchart to work with circular buffer.
Rather than within PORT IOC, its just as effective being within a timer interrupt as keypad constantly read 61 times a second!
I have also realised if wrong code entered, then you may not be able to enter correct code straight away because of wrong values set that are already within the buffer.
To flush buffer after 4th wrong number. I decided against as they only could be three key presses since then.
You could then press the first correct number, so that would make the fourth number!
Therefore, I have decided to auto flush buffer after 10 seconds has elapsed of non key pressing.

I have moved topic from bugs, as it's not a bug.
Attachments
Keylock-circullar buffer 3b.fcfx
(14.62 KiB) Downloaded 157 times
Martin

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Interrupt on port B in PIC16F88 nor work

Post by medelec35 »

Attached is an improvement on the previous one.
With this version everything added to main will be ignored to operate keypad and solenoid if correct code is entered.
For example you can add a 300 second delay component, it will halt main for 300 seconds, but solenoid will still work before 300 seconds has elapsed.
There are no delays components within interrupt so all other interrupt's wont be affected, even though solenoid is off 1 second later it was triggered.
Attachments
Keylock-circullar buffer 3c.fcfx
(15.86 KiB) Downloaded 137 times
Martin

maharadga
Posts: 71
Joined: Mon Dec 01, 2014 1:38 pm
Location: Bulgaria
Has thanked: 17 times
Been thanked: 12 times
Contact:

Re: Interrupt on port B in PIC16F88 nor work

Post by maharadga »

Thank you, medelec35, for your time and guidance. In fact, I have a code lock program developed without Circular Buffer. Of course, I did it in a simplistic way that someone like you with more knowledge would laugh at, but it works. This example I gave is a test of using interrupt and buffer to see if I can save free space as code. But the opposite happened.
By the way, I have noticed that the same program /I do not mean this, but in principle/ compiled in version 5 takes up much less space than in version 7 or 8. What is the reason?
Also, when the Circular buffer is included in the program, the error window always pops up when running the program, but no errors are displayed. Also, version 7 doesn't show me the console window. I uninstalled, reinstalled, but to no avail. I use Windows 10 with all the latest updates. I wrote in another post about this problem, even I think you answered me that everything is normal for you and surely it is. However, why is this with me? However, I do not have this problem with the crash of version 8, which is widely talked about. It happened to me once and it was.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Interrupt on port B in PIC16F88 nor work

Post by medelec35 »

Hi maharadga,
Your welcome.
maharadga wrote:By the way, I have noticed that the same program /I do not mean this, but in principle/ compiled in version 5 takes up much less space than in version 7 or 8. What is the reason?
For 8 bit microcontrollers, the compiler was changed from BoostC to XC8 from Flowcode version 6 onwards.
If I remember correctly, BoostC was not supporting the newer micros and the range of micros that supported was very limited.
This would frustrate customers.
AS XC8 did support the newer micros, it was felt a change was necessary.
Also I believe another reason is progress. the more functions added, the more space will be taken.
There is probably a trade off between added functions and space used.
Matrix staff would know much more about this then I do.
maharadga wrote:Also, when the Circular buffer is included in the program, the error window always pops up when running the program, but no errors are displayed.
I have noticed that with few components.
Not sure why it does that, but at least you know its error free. :lol:
maharadga wrote:version 7 doesn't show me the console window.
The console window only shown if you have the test & debug pack installed.
Do you have that installed with both V7 & V8?
This tells you what you get for each pack.
Martin

maharadga
Posts: 71
Joined: Mon Dec 01, 2014 1:38 pm
Location: Bulgaria
Has thanked: 17 times
Been thanked: 12 times
Contact:

Re: Interrupt on port B in PIC16F88 nor work

Post by maharadga »

Huh, I didn't buy the test and debug package.
That's the reason, then.

Post Reply