How to use the MK60FN1M0VLQ15 Analog-Compare module ?

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use the MK60FN1M0VLQ15 Analog-Compare module ?

263 Views
Contributor I

Hello,

How to use the MK60FN1M0VLQ15 Analog-Compare(Comparator) module ?

Best Regards,

Kenta

Labels (1)
0 Kudos
5 Replies

7 Views
Senior Contributor I

I would like to use the block diagram as reference to be as clear as possible.

Please notice there is the CMP module, you can get from this comparator module 2 outputs: simple comparison result CMPO or generate an interrupt IRQ depending on the window and filter control (sample input).

In the inputs for the CMP module you will notice you have 2 mux from ANMUX module, here you will choose your 2 inputs from signals listed below, for select signals you should go to the 38.7.6 MUX Control Register (CMPx_MUXCR), for the INP use the PSEL (Plus Input MUX Control) field and for INM use the MSEL (Minus Input MUX Control) field:

  • Reference 0 - IN0
  • Reference 1 - IN1
  • Reference 2 - IN2
  • Reference 3 - IN3
  • Reference 4 - IN4
  • Reference 5 - IN5
  • Reference 6 - IN6
  • DAC Output - IN7

If you chose to use the IN7 or DAC Output ou should configure the DAC to use it.

pastedImage_0.png

Please take a look on the 38.8 CMP Functional Description in the K60P144M150SF3RM reference manual.


Have a nic day :P,
Perla

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

7 Views
Contributor I

Hi Perla,

Thanks for your answer.

On the CodeWarrior Processor Expert,  I want to use CMP module to  compare the signals of PTC6 and PTC7, and output result on PTC5, please let me know How to do it ?

Kenta

0 Kudos

7 Views
Senior Contributor I

Ok, based on the pins you mention:

  • PTC6 = CMP0_IN0
  • PTC7 = CMP0_IN1
  • PTC5 = CMP0_OUT

Based on this, after you open CodeWarrior and create a new project with PEx, you will open the Hardware perspective and select the CMP0 module on the chip image, right click and select Add Analog Comparator module.

Then in the left pane (Component Inspector) configure your module with the pins you want to use.

MK60_CMP0_selection.JPG.jpg
Have a nic day :P,
Perla

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

7 Views
Contributor I

Perla,

I think there is something wrong. I use the comparator(AnalogComp_LDD) in MKL25Z MCU is succeed, but do not succeed in MK60FN MCU.

please let me know What's wrong ... ?

Regards,

Kenta 

0 Kudos

7 Views
Senior Contributor I

Could you please explain me what is the specific problem with K60?

It does not compare nothing at all?

Do you get something in the output?

Can you built your project?

0 Kudos