Page 1 of 1

Flowcode 5 PORT interrupt selectivity

Posted: Thu Jun 28, 2012 6:12 pm
by randomrichard
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.87 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

Re: Flowcode 5 PORT interrupt selectivity

Posted: Thu Jun 28, 2012 6:56 pm
by medelec35
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.

Re: Flowcode 5 PORT interrupt selectivity

Posted: Thu Jun 28, 2012 8:47 pm
by dazz
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

Re: Flowcode 5 PORT interrupt selectivity

Posted: Wed Jul 04, 2012 2:36 pm
by Enamul
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

Re: Flowcode 5 PORT interrupt selectivity

Posted: Wed Jul 04, 2012 4:15 pm
by randomrichard
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 306 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

Re: Flowcode 5 PORT interrupt selectivity

Posted: Wed Jul 04, 2012 4:39 pm
by Enamul
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

Re: Flowcode 5 PORT interrupt selectivity

Posted: Wed Jul 04, 2012 5:34 pm
by Enamul
Hi Richard,

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

http://www.matrixmultimedia.com/mmforum ... ADC#p21343

Enamul

Re: Flowcode 5 PORT interrupt selectivity

Posted: Wed Jul 04, 2012 9:20 pm
by randomrichard
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