Beginner in need of help !!


Results 1 to 40 of 72

Threaded View

  1. #35
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: Beginner in need of help !!

    Rob,

    Yes Comparators can be confusing the 1st time using them on the PIC MCU.

    First, have a read through this link.
    http://www.cuteminds.com/index.php/e...23-comparators

    It explains simply how the comparator
    on the PIC12F683 can be used. Ignore the C language stuff, but pay attention
    to the setup of the Comparator, especially the Second Case.
    This case describes what you will probably implement.

    This will give you the info on how the Comparator will work by polling the
    Comparator output, NOT USING INTERRUPTS.

    Once you have this digested, then you can move on to the Interrupt portion.

    Use the equation for VRR=1 (Low Range): (VR3:VR0/24) x Vdd to set the "Threshold Voltage"

    E.g.
    Vdd = +5Vdc
    VR3:VR0 = 5 (%1001)

    Putting this into the equation above gives this CVref "Threshold voltage"

    (5/24) x 5 = 1.042 Vdc

    This will be the reference voltage that will be used to compare the input voltage to.

    General Rules when using the Comparator:
    1. Set the appropriate pins to analog for the Comparator with ANSEL
    2. Set the direction of the pins appropriately with TRISIO
    3. Configure the Compare Module using CMCON0
    4. Configure the reference voltage using VRCON
    To use the comparator, poll the value of the status bit in CMCON0.

    See if this gets you started.

    Regards,
    Last edited by Tabsoft; - 23rd January 2015 at 20:10. Reason: Forget a general rule
    Regards,
    TABSoft

Similar Threads

  1. Beginner help!
    By Recognize in forum General
    Replies: 14
    Last Post: - 26th April 2012, 15:55
  2. pic24 beginner
    By robertpeach in forum General
    Replies: 23
    Last Post: - 13th August 2009, 12:57
  3. need help! to beginner
    By emilhs in forum mel PIC BASIC Pro
    Replies: 27
    Last Post: - 6th May 2009, 19:44
  4. Beginner at PB
    By alphahr in forum Off Topic
    Replies: 1
    Last Post: - 21st April 2008, 18:43
  5. Can anyone help a beginner in a struggle?
    By douglasjam in forum mel PIC BASIC
    Replies: 1
    Last Post: - 6th May 2005, 00:29

Members who have read this thread : 0

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