CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Comparator and TRIS question

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
iso9001



Joined: 02 Dec 2003
Posts: 262

View user's profile Send private message

Comparator and TRIS question
PostPosted: Thu Jul 06, 2006 1:19 pm     Reply with quote

Hello,

I'm trying to figure out that when is use setup_comparator(D1_VR_D3_VR ) on a (18F QFP44 part) if I can still use D0, D2, D3 for output by setting the tris on these to output (which I think should work, just won't be hooked to the comparator module)

Or... If I set the TRIS then output low on D3 for instance is it going to trigger the comparator since D3 will be lower then Vref?

Also... on a more CCS note does anyone know what the setup_comparator function is doing with its constant ? For instance

D1_VR_D3_VR = 0x0Aff06

The last byte I beleive is the CMCON register, and the first byte is the byte to TRIS, but I'm not sure what the second byte is. I only ask because CCS doesn't include an option to inverse the comparator output (bits 4 and 5 of CMCON), and I want to add these myself.
iso9001



Joined: 02 Dec 2003
Posts: 262

View user's profile Send private message

PostPosted: Fri Jul 07, 2006 1:16 pm     Reply with quote

I checked back and saw no replies this morning... So I figured maybe a dumb question ?

I checked the datasheets and reread old posts.... Nada. Anyone have any advice here ?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jul 07, 2006 1:26 pm     Reply with quote

The reason might be that in your last thread several people gave
good replies, but you declared that only one person got the "win",
which sort of devalued everyone else's efforts. Based on limited
information, I'm sure everyone gave the best answer they could
think of, and there's no way we could know the ultimate problem,
so declaring that only one of us "got the win" probably bummed
out everyone.
iso9001



Joined: 02 Dec 2003
Posts: 262

View user's profile Send private message

PostPosted: Fri Jul 07, 2006 3:16 pm     Reply with quote

Yea.... but that was the answer to the problem. So he won.... Its not an important game and he got no prize. I said in that post that I appreciate everyone's help. I know no one 'has' to think about the problem then post a possible solution, eveyone has thier own work to do, I appreciate that a lot. You experience is also greatly appreciated PCM.

Newguy just happened to post a personal experience about his SPI LCD that was exactly the problem I had. Something I didn't think could happen. So he won but its not like I ignored everyone else, I bench tested every single option everyone posted. Didn't mean to step on any toes.

CCS is a very lucky company to have so many helpful and intelligent people that hang around here. Wink

Back to the point at hand.... It looks as if I could still use the D0 and D2 as input or output since they don't seem to be connected to the comp module. But if I want D3... I can only use that one as an output ?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Jul 08, 2006 1:37 am     Reply with quote

Quote:
I'm trying to figure out that when is use setup_comparator(D1_VR_D3_VR ) on a (18F QFP44 part)

Post the PIC's part number.
iso9001



Joined: 02 Dec 2003
Posts: 262

View user's profile Send private message

PostPosted: Sat Jul 08, 2006 12:25 pm     Reply with quote

18F4680

I'm thinking I'll be OK either way with the D0 and D2 pins since those are the pins the Vref replaces as links to the comparator. So it wouldn't make sense if they effected the comparator at all.

Its just D3 and the setup_comparator() constant I'm still curious about,
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jul 09, 2006 3:30 pm     Reply with quote

You're using the comparators in mode 6. The data sheet has a diagram
of this mode, in section 20.1 "Comparator Configuration". It's the one at
the bottom right, labeled "Four Inputs Multiplexed to Two Comparators".

It shows that all four pins are configured as Analog inputs. The
following post discusses how you can have problems if you try to
use these pins for digital i/o:
http://www.ccsinfo.com/forum/viewtopic.php?t=21825&start=21
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group