Page 1 of 1

Custom Interrupt for Comparator 16F627A

Posted: Tue Jan 09, 2018 10:41 am
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 .

Re: Custom Interrupt for Comparator 16F627A

Posted: Thu Jan 11, 2018 8:38 am
by skquah
Hello, everyone out there
Is there anyone out there can help me to solve this comparator issue ? Thank you in advance .

Re: Custom Interrupt for Comparator 16F627A

Posted: Tue Jan 23, 2018 4:37 am
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..

Re: Custom Interrupt for Comparator 16F627A

Posted: Tue Jan 23, 2018 6:40 pm
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.