PIC18F comparator

Discussion in 'General Electronics Chat' started by Dritech, Dec 30, 2013.

  1. Dritech

    Thread Starter Well-Known Member

    Sep 21, 2011
    Hi all,

    I want to use one of the comparators integrated in the PIC18F4550 to detect over-current in six different motors. The input will be connected to a Hall current sensor. Since the same sensor will be used for all six motors, I want to change the reference voltage of the comparator during operation because not all motors consume the same current. To do so, I was going to use the internal reference module but the datasheets states:

    Does this mean that I have to enable both comparators even though I am going to use one?
    Last edited: Dec 30, 2013
  2. atferrari

    AAC Fanatic!

    Jan 6, 2004
    I am not answering your question, I know, but I suggest that no matter how you use the comparators make sure you check the errata for that micro.

    IIRC there were some combinations that did not work or required a workaround. Good luck.
  3. GopherT

    AAC Fanatic!

    Nov 23, 2012
    I would simply use the ADCs in the chip instead. It is easier from my point of view since you can rout the input of 10 different pins to the ADC module - your various references and the sensor. I think it only takes a microsecond or two to change the pin and collect a sample from the AdC with 12-bit resolution.
  4. Dritech

    Thread Starter Well-Known Member

    Sep 21, 2011
    Hi again,

    I am using the PIC18F internal comparator module for another project. Is the comparator program dependent or I can use it while the program is executing the code?
  5. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    Once you have set up the comparator once in the code, it will operate as an independent analogue comparator.

    In this capacitance meter project, I used the PIC's internal comparator as an independent oscillator. It works exactly the same as if I had used an external comparator;
    Dritech likes this.
  6. Dodgydave

    AAC Fanatic!

    Jun 22, 2012
    I would use an external op amp comparator and feed it into one of the A/D channels, its a lot easier.