PIC12F617 Comparator not working

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

Moderator: Benj

Post Reply
Jörg Güldner
Posts: 77
Joined: Wed Jun 22, 2011 3:32 pm
Has thanked: 17 times
Been thanked: 11 times

PIC12F617 Comparator not working

Post by Jörg Güldner »

Hello Anyone,
an old project is running under Flowcode V6. Now under V8 is a other compiler. There I couldn`t get the comparator working. May be, that the syntax is not correct writtten from me. Program is in the attachment. Analog in is on pin6, reference is set to intern. The dedicated flag is read out and sets the output to high or low. A smal program. But I get it not running. Is there anyone, who have an idea?

Best regards

Jörg
Attachments
PIC12F617_Comparator test_Flowcode V8.fcfx
(10.6 KiB) Downloaded 194 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: PIC12F617 Comparator not working

Post by Benj »

Hello Jorg,

The only thing I spotted is this inside the decision icon in the interrupt macro.

comparator_flag_bit = 1

Try this instead

comparator_flag_bit

This will check to see if the value is anything but 0 and might help if the value returned isn't strictly a 1.

Jörg Güldner
Posts: 77
Joined: Wed Jun 22, 2011 3:32 pm
Has thanked: 17 times
Been thanked: 11 times

Re: PIC12F617 Comparator not working

Post by Jörg Güldner »

Hello Benj,
thanks for your answere. I`ve got it running now, but is was not "comparator_flag_bit = 1".

From the old project and written in big letters = FCV_COMPARATOR_FLAG_BIT = test_bit(PIR1, CMIF);
and clear_bit (PIR1, CMIF);
is not running!

Changing to FCV_COMPARATOR_FLAG_BIT = PIR1bits.CMIF;
and PIR1bits.CMIF = 0;
works fine.

Jörg

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: PIC12F617 Comparator not working

Post by Benj »

Hi Jörg,

Excellent glad you've got it working and many thanks for letting us know.

Post Reply