Custom Interrupt for Comparator 16F627A

A collection of posts and articles on getting started in Flowcode v6

Moderator: Benj

Post Reply
skquah
Posts: 39
Joined: Fri Dec 12, 2014 3:57 pm
Has thanked: 26 times
Been thanked: 10 times
Contact:

Custom Interrupt for Comparator 16F627A

Post by skquah »

Hello, Benj and everyone
1) I have read thru' the forum article by Dave Squibb and Benj dated 29 February 2016 on the above topic .
2) As I try to test out this V6 flow-code in the hardware circuit and I could not get it working base on the suggestion in the forum .
3) Benj have suggested to use Mode CM < 2:0 > = 010 , so that we can used the VREF from the module . I have tried this suggestion but I still
cannot get the output at the RB7 ( Led ) . I have also tried Dave Squibb suggestion but it still cannot work .
4) I am not sure this is a V6 software mismatch or the custom interrupt code issue .
5) I will be very much appreciate if anyone could help me out to fix this problem .
6) I will be attaching my test schematic circuit hardware and V6 flowcode for your attention and correction . Thank you .
Attachments
Comparator Mode 010.fcfx
(6.61 KiB) Downloaded 267 times
Comparator, Exercise 010.PNG
(30.53 KiB) Downloaded 2521 times

skquah
Posts: 39
Joined: Fri Dec 12, 2014 3:57 pm
Has thanked: 26 times
Been thanked: 10 times
Contact:

Re: Custom Interrupt for Comparator 16F627A

Post by skquah »

Hello, everyone out there
Is there anyone out there can help me to solve this comparator issue ? Thank you in advance .

skquah
Posts: 39
Joined: Fri Dec 12, 2014 3:57 pm
Has thanked: 26 times
Been thanked: 10 times
Contact:

Re: Custom Interrupt for Comparator 16F627A

Post by skquah »

Hello Benj. and everyone out there
1) After this custom interrupt comparator topic has been posted since 11 January 2018 by me . I have noticed there are quite a number
of viewer ( 87 viewer ) are searching on the comparator flow code knowledge and application , but unfortunately there is no answer to
to the above question thus so far . I feel a bit let down !!
2)Anyway, since on the V6 software C code we may not have the knowledge to apply . // C code FCV_C2 = test_bit ( cmcon, C2OUT ) ;
But there is still a way we can directly output the comparator either thru' RA3 ( Comp. 1 ) or RA4 ( Comp. 2, open drain ) .
I have tested it, it work ok on hardware. I am sharing this on today posting. Thank you..
Attachments
Comparator Mode 110.fcfx
(10.77 KiB) Downloaded 266 times
Comparator, Exercise 110.PNG
(23.73 KiB) Downloaded 2433 times
Comparator, Exercise 110, open drain.PNG
(24.57 KiB) Downloaded 2433 times

User avatar
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:

Re: Custom Interrupt for Comparator 16F627A

Post by Benj »

Sorry for the delay very busy in the office this week, I'm having a look at the project now for you.

...

Looking at the program you are initialising the comparator, disabling the comparator interrupt and re-enabling the comparator interrupt in a loop at high speed. This is likely causing the issues you're seeing.

Maybe move the three icons out of the loop and place them before the loop?

...

Just looked at your first program and the code is before the loop here. So I'll use this one for reference.

...

Your custom interrupt code and comparator setup code look fine. I'll have another pass tomorrow morning and see if I can spot anything else.

Post Reply