MK60F12.h

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MK60F12.h

3,204 Views
kassianikotsido
Contributor III

Hello.

I try to program a TWR-K60F120M using CodeWarrior. The file MK60F12.h is included in the sample main.c program. Is anywhere description of the file? It seems that the macro GPIO_PIN(10) refers to the blue LED. How will the argument  of the GPIO_PIN need to change in order to refer to the green, yellow and red lights?

Labels (1)
12 Replies

2,520 Views
adriancano
NXP Employee
NXP Employee

Hi,

It seems that you are running the gpio example, is that right? If it is like that then you can find in the gpio_k60.c file the next macros:

#define GPIO_PIN_MASK             0x1Fu

#define GPIO_PIN(x)                     (((1)<<(x & GPIO_PIN_MASK)))

And in the code you find the line:

GPIOA_PTOR&=~GPIO_PDOR_PDO(GPIO_PIN(10));

And this one turns the BLUE led

You can change the value of the x in the macro GPIO_PIN(x) to change the value pin of each led. According to the schematic (TWR-K60 SCH)

k60 leds.png

You can wirte:

GPIO_PIN(10) --> BLUE LED

GPIO_PIN(29) --> GREEN LED

GPIO_PIN(28) --> YELLOW LED

GPIO_PIN(11) --> ORANGE LED

I hope this information can help you.

Regards,

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. It would be nice!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

2,520 Views
kassianikotsido
Contributor III

Hi, Adrian. Thank you so much for your answer.  Where can I find the gpio_k60.c file?

0 Kudos
Reply

2,520 Views
adriancano
NXP Employee
NXP Employee

What is the file where you can find the macro GPIO_PIN(10)?

But as I told you can wirte:

GPIO_PIN(10) --> BLUE LED

GPIO_PIN(29) --> GREEN LED

GPIO_PIN(28) --> YELLOW LED

GPIO_PIN(11) --> ORANGE LED

Regards,

Adrian

0 Kudos
Reply

2,520 Views
kassianikotsido
Contributor III

I found the macro in the file that a friend of mine sent. I have hard time to call the several i/o from my c or assembly (preferable) file. Can you throw some light?

0 Kudos
Reply

2,520 Views
adriancano
NXP Employee
NXP Employee

Hi,

If you have CodeWarrior installed you can find an example project which demonstrates the use of the SW buttons in the Tower board using interrupts and toggling the leds. Go to this path in the installation folder: <install folder>\Freescale\CW MCU v10.6\MCU\CodeWarrior_Examples\Kinetis_Examples\k60\gpio In that example you can find the gpio_k60.c file.

Regards.

2,520 Views
kassianikotsido
Contributor III

Hi, Adrian. Thank you for your reply. Are there any samples in assembly or in c with inline assembly?

0 Kudos
Reply

2,520 Views
adriancano
NXP Employee
NXP Employee

Hi,

All the sample codes are in C language but you can check select the disassemble option to see the assembler code of that file, check the image below.

disassemble.png

I hope this information can help you.

Regards,

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. It would be nice!

-----------------------------------------------------------------------------------------------------------------------

2,520 Views
kassianikotsido
Contributor III

Hi, Adrian. You are super. Kassiani

0 Kudos
Reply

2,520 Views
adriancano
NXP Employee
NXP Employee

You are welcome, if you questions are now answered please feel free to mark one of this answers as Correct answer.

Kind regards,

Adrian

2,520 Views
kassianikotsido
Contributor III

How can I mark an answer as correct? I do not see this option.

0 Kudos
Reply

2,520 Views
adriancano
NXP Employee
NXP Employee

Hi,

Just below each answer you can see this two buttons.

correct.png

You can click on them to select correct answer or helpful answer.

Kind regards

0 Kudos
Reply

2,520 Views
kassianikotsido
Contributor III

Hi, Adrian. I do not have the buttons you are refering to. Attached is how my inbox looks like.

my freescale inbox.jpg

0 Kudos
Reply