This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Comparator Configuartion for the EK-TM4C1294

Other Parts Discussed in Thread: LM339

Hello TI Friends,

I'm using the 3 comparator's. My idea is to compare an external voltage with the internal reference Voltage to trigger an Interrupt. I am also using the driverlib which is provided from TI. And my Problem is: I want to configure the respective GPIO pin for the Comparator with the function GPIOPinConfigure(uint32_t ui32PinConfig);.

For "uint32 ui32PinConfig" i looked at the Header-File pin_map.h and there was not a Pin for the Comparator(Pins: PC7, PC4 and PP1) and now i dont know what ui32PinConfig for the Comparator coud be. This three Pins are analog Inputs, could be that the Problem?

Best regards 

  • Hello user4558488,

    Please use the TI Pin Mux Utility to define the IO Configuration to get the required code.

    Look at INFO#01 in the following post

    e2e.ti.com/.../374640

    Regards
    Amit
  • Hasn't that MCU (both) analog & digital comparators? (we don't use vendor's 129x family)

    I doubt that you've 3 analog comparators - these (analog) comps are (by far) are favorite.

    To use the digital comparators you must (first) feed your SUT (signal under test) into one of the MCU's ADC capable pins. After that - you should be able to use the digital comparator to "weigh against" your 2 signals of choice.

    At the risk of blasphemy - if you do not have 3 analog comparators on chip - I'd strongly suggest the uber popular LM339 (quad voltage comparator). This device has a far wider input voltage range than any MCU - has an open collector output (you can easily & properly "pull-up" to 3V3 for feeding the MCU's GPIO) and is far less complicated than mastering all the nuances of the MCU's digital comparators and their linkage to the (proper) ADC channel. (we've never even tried such a process)

    Final point in favor of LM339 (or similar) - this comparator array runs far faster and "without" the necessity for MCU software to maintain proper operation. (i.e. NOT hang!) LM339's outputs are fed to far simpler GPIO inputs - which may be configured quickly/easily - to trigger your desired interrupt...

    Often we find "ease and speed of use" far trumps "MCU as kitchen sink." Only after - and "if" - you (need) to save the "pennies" of LM339 meager cost - would I consider adding the complexity offered by the "kitchen sink." (i.e. and that's (almost) Never!)

    [edit] I note that vendor's MCU expert (Amit) beat me to the punch by some few minutes.   And - his interest is the "kitchen sink" - mine (instead) - the quick, reduced effort, and rapid meeting of your (real) requirement!    Note further - (downstream) you'll likely employ a different MCU (i.e. progress) and ALL of your demanding, super-specialized reading & coding of (this) MCU's digital comparators - will be of little (i.e. NO) use!   Your 339 comparator - in stark contrast - on breadboard or mini pcb - can serve (Repeatedly) as a very effective, reusable "Building Block!"   Efficiency is (so often) the name of the game - undue, special (one-off) complexity - not so much....

  • Hello cb1

    Thank you for the mention: Directing the poster to a tool rather than opening up the gpio.c seemed more appropriate.

    Regards
    Amit
  • Hi Amit,

    And thank you for your mention. And agreed that a "tool" trumps "blind poster RTFM."

    Yet - that said (and especially that said) simple LM339 (i.e. your device!) proves immensely simpler, easier and requires 1/10th the time to read, understand & implement.

    I will bet you - that w/out you, "doing the heavy lifting" - poster's attempt to "succeed" w/3 digital comparators will take weeks! Yes the MCU incorporates (some) of the LM339's features (but none of its full, analog capabilities - and vastly expanded input signal range) and my point of "future MCU introductions "confounding" ALL of poster's time/effort investment - point w/out question to the superiority of "external comparator" to Do this job! (some things from the past - really - cannot be significantly improved!)

    Cramming yet more into an undersized sack - which demands far more time/effort/experience to fully/properly comprehend - may not (universally) make sense!