Please give more infomation on your hardware setup, if you are using an RTOS, which version of codewarrior, which language (C, C++, assembler).
First you need to connect the LED's to the processor somehow - you may need to use buffers, transistors/FETs, or a driver IC as it's not a good idea to power things directly from pins on the micro (they can only provide a small amount of power).
If you are connecting using transistors, you would wire to some GPIO pins. Using a driver IC it may communicate over SPI or I2C.
Then you need to look at how to control what you have done;
- If you have "one LED per pin" connected to the micro's GPIO you need to configure the port registers to work as GPIO output, then you write data to the GPIO register to make the pins turn ON/OFF.
- If you have to talk to a driver IC you need to find some code to communicate with it.
As an example, we have an LED connected to PortTJ pin 1 and this is the macro to control it:
#define LED_RED_TOGGLE (MCF_GPIO_PORTTJ = (uint8)(MCF_GPIO_PORTTJ ^ MCF_GPIO_PORTTJ_PORTTJ1)) // XOR with BIT1#define LED_RED_OFF (MCF_GPIO_SETTJ = MCF_GPIO_PORTTJ_PORTTJ1)#define LED_RED_ON (MCF_GPIO_CLRTJ = ~MCF_GPIO_PORTTJ_PORTTJ1)
So in the main code you would just write "LED_RED_ON;" to turn the LED on.
Thanks for your reply.
I have MPC5510Kit development tool and there is a led matrix on it.
As beginning to C programming, I want to try controlling these leds.
http://cache.freescale.com/files/dsp/doc/ref_manual/MPC5510EVBUM.pdf?fpsp=1 (see page27 for led matrix)
http://cache.freescale.com/files/32bit/doc/ref_manual/MPC5510RM.pdf?fpsp=1 (MCU referance manual)