2 voltages compare to Vref & interrupt

Discussion in 'Embedded Systems and Microcontrollers' started by oookey, Nov 23, 2014.

  1. oookey

    Thread Starter Member

    May 24, 2010
    62
    0
    Hi ,

    Please refer to the sketch for the circuit arrangement, I tried to compare two voltages Vin1 and Vin2, whichever greater than Vref (0.4V), will trigger interrupt to stop output, if both voltages lower than Vref interrupt will start output again.

    I’m using 16f628A mikroC compiler, any suggestions how I should configure the chip to have 0.4V reference, and what other registers that involve in this task? Thanks
     
  2. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    Look at page 64 of the datasheet, I think CM<2:0> = 011 is what you are looking for.
     
  3. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,395
    1,607
    That looks like the comparator setting I would use.

    For a full listing of register settings see:
    TABLE 10-1: REGISTERS ASSOCIATED WITH COMPARATOR MODULE
    TABLE 11-1: REGISTERS ASSOCIATED WITH VOLTAGE REFERENCE
     
Loading...