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?
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)
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!
-----------------------------------------------------------------------------------------------------------------------
Hi, Adrian. Thank you so much for your answer. Where can I find the gpio_k60.c file?
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
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?
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.
Hi, Adrian. Thank you for your reply. Are there any samples in assembly or in c with inline assembly?
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.
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!
-----------------------------------------------------------------------------------------------------------------------
Hi, Adrian. You are super. Kassiani
You are welcome, if you questions are now answered please feel free to mark one of this answers as Correct answer.
Kind regards,
Adrian
How can I mark an answer as correct? I do not see this option.
Hi,
Just below each answer you can see this two buttons.
You can click on them to select correct answer or helpful answer.
Kind regards
Hi, Adrian. I do not have the buttons you are refering to. Attached is how my inbox looks like.