Comparator not tripping above 0.6V (Vref) on PIC 16F690


Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891

    Default Comparator not tripping above 0.6V (Vref) on PIC 16F690

    Hi All,

    I'm struggeling to get my 16F690's comparator 2 output to trip when the measured voltage gets above 0.6V (for battery level monitoring).

    Code:
    ' ====== FUSES =====================================================================================
    @ __config _FCMEN_OFF &_IESO_OFF &_CPD_OFF &_WDT_OFF &_INTRC_OSC_NOCLKOUT &_BOR_OFF &_CP_OFF &_PWRTE_OFF &_MCLRE_OFF
      
    ' ====== REGISTERS =================================================================================
    ' Registers   76543210
    OPTION_REG = %10000000 ' PORT A&B Pull-Ups and Prescaler        (def.: %11111111)
    OSCCON     = %01100000 ' Internal Oscillator 4MHz               (def.: %01101000)
    TRISC      = %00001000 ' Set Input/Output (0 to 7)              (def.: %11111111)
    
    CM2CON0    = %10100011 ' Comparator2 Module                     (def.: %00000000)
    ' Bit1/C2ON = Comp C2 is ON
    ' Bit5/C2OE = Output is PORTC.4
    ' Bits1-0   = Input is PORTC.3
    
    VRCON      = %00110000
    ' Bit2/C2VREN = Comparator C2 voltage ref is ON
    ' Bit4/VP6EN  = 0.6V ref is ON
    
    ' ====== DEFINES ===================================================================================
    DEFINE OSC 4
    
    ' ====== PROGRAM START =============================================================================
    MAIN:
        GOTO MAIN:
    END


    These are the registers:

    Name:  000242.png
Views: 372
Size:  75.1 KB
    Name:  000240.png
Views: 355
Size:  57.0 KB


    And this is my PIC:
    Name:  000243.png
Views: 354
Size:  66.7 KB

    My voltage divider (that comes from Vbatt) is connected to PORTC.3 and I'm expecting the PORTC.4 (C2 output pin) to trip when Vbatt exceeds 0.6Volts, but this nevers happens.

    What am I missing please?
    Last edited by flotulopex; - 22nd May 2020 at 22:44.
    Roger

Similar Threads

  1. 16F690 VREF PGC question
    By dsicon in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 2nd February 2014, 16:14
  2. Replies: 2
    Last Post: - 31st May 2013, 18:19
  3. 18F2525 A/D, Comparator and Vref modules
    By fbraun in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 20th May 2005, 23:17
  4. accurate vref < 1vdc 16F876 comparator
    By mslaney in forum Schematics
    Replies: 1
    Last Post: - 23rd March 2005, 01:44
  5. switching external vref+ and vdd vref
    By alejandro_halon in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 16th February 2005, 20:13

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