Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

PIC16F62X - Comparator Module

2 posters

Go down  Message [Page 1 of 1]

1PIC16F62X - Comparator Module Empty PIC16F62X - Comparator Module Sun Jul 30, 2023 3:53 pm

RagmaAraujo



Does anybody tried comparator module on PIC16F62X series? Did it work? scratch

2PIC16F62X - Comparator Module Empty Re: PIC16F62X - Comparator Module Mon Jul 31, 2023 8:57 am

arcachofo

arcachofo

As far as I know it is working in general.
But I don't know if it works in all possible configurations.

You can try with the last revision for 1.0.0, there are some issues fixed.
Download it here: https://simulide.forumotion.com/t390-simulide-1-0-0-tester-builds

If this doesn't solve the issue, you can share your circuit and firmware to see what is happening.
Or at least share the configuration you are using.


RagmaAraujo likes this post

3PIC16F62X - Comparator Module Empty Re: PIC16F62X - Comparator Module Tue Aug 01, 2023 1:00 am

RagmaAraujo



I configured CMCON as one independent comparator (xx00x101). RA1 as reference voltage on Vin-; RA2 as variable input on Vin+. RB7 is configured as output to control a DC motor.

I apologize for any eventual mistakes on circuit or coding. The files (circuit and firmware) can be acessed on link below:

https://drive.google.com/drive/folders/1QVh8iav37_1CEitxpgPRQDspTm-sv5jf?usp=sharing

4PIC16F62X - Comparator Module Empty Re: PIC16F62X - Comparator Module Tue Aug 01, 2023 3:30 am

RagmaAraujo



RagmaAraujo wrote:I configured CMCON as one independent comparator (xx00x101). RA1 as reference voltage on Vin-; RA2 as variable input on Vin+. RB7 is configured as output to control a DC motor.

I apologize for any eventual mistakes on circuit or coding. The files (circuit and firmware) can be acessed on link below:

https://drive.google.com/drive/folders/1QVh8iav37_1CEitxpgPRQDspTm-sv5jf?usp=sharing

I almost forgot to post a quick explanation of comparator issues: When analogic signal on RA2 get higher than RA1, the output of CM2 (C2OUT) doesn't change. Also, bit flag CMIF doesn't set.

5PIC16F62X - Comparator Module Empty Re: PIC16F62X - Comparator Module Tue Aug 01, 2023 11:17 am

arcachofo

arcachofo

Thanks, I could reproduce the issue.

There is an error in file: data/PIC/p16F627/p16F627_perif.xml
Solved at Rev 1379.

You can fix it yourself easily in Simulide by clicking in "File explorer" tab (left panel), then open "Data" and find the file, double click and it will open in Editor.

PIC16F62X - Comparator Module Co11


Then in the Editor, at the end of the file replace the sections for comparators with this:
Code:

  <comp name="COMP1" type="01" configregsA="CMCON"
                     interrupt="ACOMP"
                     pins="PORTA0,PORTA3,PORTA2"/>

  <comp name="COMP2" type="02" configregsA="CMCON"
                     interrupt="ACOMP"
                     pins="PORTA2,PORTA1,PORTA4"/>

Save the file and restart Simulide.

RagmaAraujo likes this post

6PIC16F62X - Comparator Module Empty Re: PIC16F62X - Comparator Module Wed Aug 02, 2023 1:31 am

RagmaAraujo



arcachofo wrote:Thanks, I could reproduce the issue.

There is an error in file: data/PIC/p16F627/p16F627_perif.xml
Solved at Rev 1379.

You can fix it yourself easily in Simulide by clicking in "File explorer" tab (left panel), then open "Data" and find the file, double click and it will open in Editor.


Thanks for help! The changes on xml worked perfectly on device. It is working in conformity of datasheet.

arcachofo likes this post

Sponsored content



Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum