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
PIC12F617 Comparator not working
Moderator: Benj
-
- Posts: 77
- Joined: Wed Jun 22, 2011 3:32 pm
- Has thanked: 17 times
- Been thanked: 11 times
PIC12F617 Comparator not working
- Attachments
-
- PIC12F617_Comparator test_Flowcode V8.fcfx
- (10.6 KiB) Downloaded 194 times
- 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
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 77
- Joined: Wed Jun 22, 2011 3:32 pm
- Has thanked: 17 times
- Been thanked: 11 times
Re: PIC12F617 Comparator not working
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
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
- 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
Hi Jörg,
Excellent glad you've got it working and many thanks for letting us know.
Excellent glad you've got it working and many thanks for letting us know.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel