Flowcode 5 PORT interrupt selectivity

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

randomrichard
Posts: 41
Joined: Thu Oct 16, 2008 11:01 am
Has thanked: 21 times
Been thanked: 7 times
Contact:

Flowcode 5 PORT interrupt selectivity

Postby randomrichard » Thu Jun 28, 2012 6:12 pm

I would post on the F5 forum but it has thrown out my requests for membership; "The requested users to be added do not exist." (!)

I do exist and have upgraded to F5.2, however I have found that your excellent F5 video dealing with interrupts doesn't tell the whole story. My F5.2 will indeed allow one to select a pin using the PIC videoed (16F1936) but not the 18F2553 that I am working with. Instead, when PORT is selected the "Properties" button remains greyed out.
no properties!.JPG
(139.88 KiB) Downloaded 1129 times
. I tried other common PIC's (16F88, 18F4550) and they also could not use the PORT option with the properties button.
Please advise me if I have missed something.

Richard

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8615
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2480 times
Been thanked: 3564 times
Contact:

Re: Flowcode 5 PORT interrupt selectivity

Postby medelec35 » Thu Jun 28, 2012 6:56 pm

Hi Richard,
Some devices have an iocb register which allow you to enable interrupts for individual portb pins.

Other devices that do not have an iocb register will have the properties greyed out.
This means you will not be able to select port interrupt on change for individual pins.
What you will have to do is select portb interrupt, then within the interrupt macro you will need create a routine that detects which portb pin has changed.

Since if any of the pins (RB4 to RB7 on older devices) change then the interrupt macro is accessed.
These users thanked the author medelec35 for the post (total 2):
randomrichard (Fri Jun 29, 2012 8:57 am) • Enamul (Wed Jul 04, 2012 2:39 pm)
Rating: 10%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 514 times
Been thanked: 467 times
Contact:

Re: Flowcode 5 PORT interrupt selectivity

Postby dazz » Thu Jun 28, 2012 8:47 pm

Hi randomrichard

Pm DavidA or one of the matrix team and they will be able to help signing up to the V5 forums hth

Regards
Dazz
These users thanked the author dazz for the post:
randomrichard (Fri Jun 29, 2012 8:58 am)
Rating: 5%
 
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Flowcode 5 PORT interrupt selectivity

Postby Enamul » Wed Jul 04, 2012 2:36 pm

Hi Richard,

At first I would like to thank Martin for the useful info.

medelec35 wrote:Some devices have an iocb register which allow you to enable interrupts for individual portb pins.

Other devices that do not have an iocb register will have the properties greyed out.
This means you will not be able to select port interrupt on change for individual pins.
What you will have to do is select portb interrupt, then within the interrupt macro you will need create a routine that detects which portb pin has changed.

Since if any of the pins (RB4 to RB7 on older devices) change then the interrupt macro is accessed.


I have implemented a simple macro which can be used in any PIC device which doesn't facilitates bit-by-bit configuration in PORTB interrupt.

In the attached program, user can use RB4 pin for rising edge detection and RB5 pin for falling edge detection and RB6 & 7 for both edge detection. But can easily modify if they need all to be rising edge or falling edge or mix.

In the sample program, for demonstration
RB4 is linked with RB0 Led
RB5 is linked with RB1 Led
RB6 is linked with RB2 Led
RB7 is linked with RB3 Led

Led at pin A0 is responding with each change in status of PIN RB4-7.

Hope this will help! :)

Enamul
Attachments
PORTB_CHGON.fcf
Not tested in hardware even though it should work
(33.83 KiB) Downloaded 138 times
These users thanked the author Enamul for the post:
randomrichard (Wed Jul 04, 2012 3:38 pm)
Rating: 5%
 
Enamul
University of Nottingham
enamul4mm@gmail.com

randomrichard
Posts: 41
Joined: Thu Oct 16, 2008 11:01 am
Has thanked: 21 times
Been thanked: 7 times
Contact:

Re: Flowcode 5 PORT interrupt selectivity

Postby randomrichard » Wed Jul 04, 2012 4:15 pm

Enamul
Thanks for the splendid Flowcode routine, which I have uploaded. I am planning to use a trigger bit to start serial recording using the 18F2553's 12bit ADC which requires use of the special event CCP2 trigger on RC1. It appears I will have to use code like yours to set the register and start the ADC using a conditional branch. I don't yet understand why the CCP2 function is not specified as such in Flowcode or whether I even have to use RC1 (or RB3). My simple test of 12bit multichannel capability, attached,
Simple_ADC.fcf
(10.5 KiB) Downloaded 124 times
doesn't mention CCP2 in the C code. I assume it is buried in one of the define statements. It looks like I could use any pin as a trigger, though maybe not as fast.
Richard

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Flowcode 5 PORT interrupt selectivity

Postby Enamul » Wed Jul 04, 2012 4:39 pm

Hi,

I am planning to use a trigger bit to start serial recording using the 18F2553's 12bit ADC which requires use of the special event CCP2 trigger on RC1.


So what I understand from your post that you need to read 12 bit ADC in PIC 18f2553 while there is a trigger event in CCP2 which is implemented in RC1. Then why do you need PORTB pin change on interrupt? Or Is that you can't use CCP2 event trigger that's why you are thinking to use one pin PORTB4-7..

Please make me clear. I have been through your ADC program. That's fine only thing I noticed you don't need Z+..e.g. unsigned integer for 12 bit ADC..Int is fine for this.

Thanks,

Enamul
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Flowcode 5 PORT interrupt selectivity

Postby Enamul » Wed Jul 04, 2012 5:34 pm

Hi Richard,

I think you can have a look in the following post about event triggered ADC read..

viewtopic.php?f=29&t=7892&p=21343&hilit=CCP+with+ADC#p21343

Enamul
Enamul
University of Nottingham
enamul4mm@gmail.com

randomrichard
Posts: 41
Joined: Thu Oct 16, 2008 11:01 am
Has thanked: 21 times
Been thanked: 7 times
Contact:

Re: Flowcode 5 PORT interrupt selectivity

Postby randomrichard » Wed Jul 04, 2012 9:20 pm

Hi
I suspect I am worrying about nothing. It's just that the 18F2553 datasheet describes using the CCP2 bit for triggered acquisitions. However, I could probably also use a pin on Port B or elsewhere as you suggest. I don't yet know enough about how much Flowcode "does for you" and where. The C code equivalent of my little test is helpful but I haven't yet written a working triggered acquisition to see if and where it arises in the code. Working being the operative word!
R