PIC16F690 Comparator C1 - some helpage needed!


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Mar 2009
    Posts
    653

    Default PIC16F690 Comparator C1 - some helpage needed!

    I'm not getting anything out of the C1 comparator, have I missed anything with my register settings

    Code:
    ANSEL =  %00000110      ' AN1-AN2 enabled - the rest all digital
    CM1CON0 = %10100000     ' C1 On, C1 Output enable, take VREF from C1In+ pin, Select C1In0- channel
    TRISA.0 = 0
    TRISA.1 = 1
    TRISA.2 = 1
    
    ANSELH = %00000011      ' AN7-AN8 enabled
    CM2CON0 = 0             'C2 off.
    I'm connecting a VREF DC level externally to pin 19 PortA.0 (which is C1IN+), something ain't right - when I scope Pin 19 -it's the yellow trace here - there's some random high/low switching going on (it should be steady DC - I checked the DC when removed from the PIC - it's rock solid...this pulseing is coming out of the PIC pin!)





    and an analogue sine wave to PortA.1 (which is C12IN0-) ...I'm scoping PortA.2 (which is C1OUT) - nothing there :-(

    Many thanks for any help!
    Last edited by HankMcSpank; - 12th March 2010 at 01:47.

  2. #2
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Ok, after spending ages on this ...and getting desperate, with one last push, I swapped everything around to use comparator2 instead - that one works fine.

    Heaven knows what's going on with then C1IN+ pin 19 !!

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    I guess I'm a little late, but ...

    You had RA0 set to Output (C1IN+)
    And RA2 set to Input (C1OUT)

    TRISA.0 = 0
    TRISA.2 = 1
    <br>
    DT

  4. #4
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Thanks Darrel, but in my defence...

    1. It was late (like 2.00am UK time).
    2. I'm a noob
    3. I'm stoopid!

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    I disagree.
    You seem to be doing fine.
    He who makes no mistakes, makes nothing.
    (one of my signature quotes)

    Anyhow, I've been playing with the tone detector I mentioned in the other thread.
    Getting some interesting results, but nothing workable yet.

    If that's where you're headed with the comparator, I may have some thoughts ... although, not very good one's.
    <br>
    DT

  6. #6
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    I disagree.
    You seem to be doing fine.
    He who makes no mistakes, makes nothing.
    (one of my signature quotes)

    Anyhow, I've been playing with the tone detector I mentioned in the other thread.
    Getting some interesting results, but nothing workable yet.

    If that's where you're headed with the comparator, I may have some thoughts ... although, not very good one's.
    Thanks for the moral support!

    re extracting frequency from an analogue using a comparator - well, as you know, I used a sig gen - it was good, I used a guitar...alas, as predicted the result were just too erratic. I'm not at the stage yet where I feel up to programming in sufficient 'intelligence' to cater for all the variations (averaging, disregarding counts outside a 'window etc'), but that's where I want to get to.

    In the meantime, I've since changed to a PIC16F690 iiit's a challenging little PIC for someone at my level, but it has way more pins for me to play with (the last IC got on my nerves becuase I had to share some of the programming pins with the comparator pins - mucho switching back & forward)

    I read that Application Note you linked me to in my other thread ....I'm still standing on the chair trying to catch the info that went way over my head!
    Attached Images Attached Images
    Last edited by ScaleRobotics; - 3rd September 2010 at 16:30. Reason: added app note AN257

Similar Threads

  1. PIC16F690 code help please
    By hysteria92 in forum mel PIC BASIC
    Replies: 1
    Last Post: - 24th February 2010, 16:17
  2. PIC16f690 LCD Not Working
    By hhosteam in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 3rd June 2009, 06:26
  3. Replies: 1
    Last Post: - 19th February 2009, 13:35
  4. Replies: 0
    Last Post: - 13th February 2009, 03:34
  5. gps rikaline x5 to pic16f690
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 9th May 2008, 11:21

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