I want Comparator 1 together with the internal voltage reference to input a signal on RF5, compare it with Vref ~0.5V, and output the result on pin RF2.
I have tried with the code below with no success - what am I doing wrong? The problem manifests itself that no matter what input level on RF5, I always get logic high on RF2.
Code:
#byte CVRCON = 0xFB5
#byte CMCON = 0xFB4
set_tris_f(~0x04); //RF2 as output
CVRCON = 0xA5;
CMCON = 0x1E;
zilog Guest
Posted: Wed Jun 27, 2007 6:00 am
I forgot to mention that Vdd-Vss = 2.5V in my application.
Kenny
Joined: 07 Sep 2003 Posts: 173 Location: Australia
Posted: Wed Jun 27, 2007 6:11 pm
The configuration that you have setup has no output to a port pin.
C1OUT is a bit in CMCON (see data sheet Fig. 21-1).
BTW the CCS constants defined in 18F87J10.h would make the code easier to read and see this kind of problem.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum