This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Beginners Question

Hi,
I have a samll problem with my MCB2360. I'm pretty new to this, so my question should be very easy to answer.

All I wanted to do was to flash my LEDs on the Board. I read the User Manual from NXP, which got me this far:

#include <LPC23xx.H>

int main() {
        //Setting Pin Select Block 4 to GPIO
        PINSEL4 = 0x00000000;
        PINSEL10 = 0;
        //initialize P2.0 till P2.7 as output
        FIO2DIR = 0x000000FF; // Set as output
        //clearing current LEDs
        FIO2CLR = 0x000000FF;
        //Mask all unneeded Pins
        FIO2MASK = 0xFFFFFFFF00;
        //Set all these Pins high.
        FIO2SET = 0x000000AA;

        while(1) {

        }
        return 0;
}

As you can see all I try to do is to enable the LEDs (P2.0 - P2.7) in the order 10101010. But nothing happens. Please help me ;)

  • you forgot to actually lit/unlit the LEDs using FIOxPIN in the loop. don't forget an interrupt driven/assembly delay to slow it down a little, or may be a simple counter will do for a start.

  • Could you reply the Code for me, please? When I add the FIO2PIN = 0x000000AA; in the loop, or inside an extra FOR-counter, it still won't lit the LEDs.
    Am I trying the wrong Port? Because there are always three LCD shining, even when I reset them via FIO2CLR. On the board these LCDs are labeled with P2.1 - P2.3.
    Thanks for your help!

  • Hi,
    I was able to resolve the problem. It seems that somehow my Projekt was noct configured correctly. All I needed to do was creating a new projekt and load the files into it.

    Thanks for your help!

    btw, my code now looks like this:

    #include <LPC23xx.h>
    
    
    void LED_Init(void) {
            PINSEL10 = 0; //Disable ETM
            FIO2DIR = 0x000000FF; //Define P2.0 ...P2.7 as Output
            FIO2MASK = 0x00000000; //Mask all pins as  editalbe
    }
    
    void LED_Out(unsigned int value) {
            FIO2CLR = 0xFF; //clear all LEDs
            FIO2SET = (value);  //lit selected LEDs
    }
    int main(void)
    {
            int a;
            LED_Init();
    
            while(1){
                    LED_Out(0xAA);
                    for(a = 0; a < 2000000; a ++); //wait about half a second
                    LED_Out(0x55);
                    for(a = 0; a < 2000000; a ++); //wait about half a second
    
            }
    }