12F629 question.


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2005
    Location
    Up the bush, Western Plains, NSW Au
    Posts
    216

    Default 12F629 question.

    Hi again everyone....
    First off, I have RTFM but cannot glean a definate answer to the following:
    I want to use the comparator in the 'F629 with the two inputs flagged to GPIO0 and GPIO1 and the output flagged to GPIO2. So far so good, I can see how to do that bit. Now, with the output appearing on GPIO2, can I also set GPIO2 up as an input so as to read the comparator status without having to feed GPIO2 back into another input, say GPIO3?
    Does having GPIO2 as the comparator output remove it from being a digital output, which could be read?
    Some more night reading coming up, I feel.
    Thanks and regards,
    Peter Moritz.

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    You missed it in the Datasheet... like they say, if you want to hide something, do it in plain sight!

    Look at the CMCON Register bit 6 - COUT (stands for Comparator OUTput). This is the bit you read to get the Comparator Output in software. Example...

    If CMCON.6=0 then goto BatteryFlat

    The state of this bit additionally depends on your setting of bit 4 - CINV (stands for Comparator INVert).

Similar Threads

  1. 12F629 PWM usage
    By MARAD75 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 10th November 2007, 13:21
  2. really simple, dumb question
    By picster in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 3rd March 2007, 22:02
  3. Question for a math guru
    By Christopher4187 in forum General
    Replies: 3
    Last Post: - 22nd November 2006, 09:45
  4. Please answer my first question
    By John_001 in forum Off Topic
    Replies: 1
    Last Post: - 15th September 2006, 06:49
  5. Servo control with 12F629
    By achilles03 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 23rd June 2005, 23:34

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts