AnsweredAssumed Answered

Configuring port to input and output in LPC845

Question asked by vidhya@lipikatech.in on Mar 14, 2019
Latest reply on Mar 22, 2019 by Ian Benton

Hi all,

 

I need to configure port pins high and low for particular port pins,

please let me know the below procedure is correct:

 

#define DATA_BUS                                   LPC_GPIO_PORT->DIRSET0
#define CONTROL_BUS                          LPC_GPIO_PORT->DIRSET1

 

Below is the part of the code to toggle led for example P0_12 [PORT 0, 12th pin]

 

        if(count<800000)//
        {  
        LPC_GPIO_PORT->DIRSET0= 1<<(LED_RED);
        LPC_GPIO_PORT->CLR0 = 1<<(LED_RED);  
        }
        
        if(count>800000&&count<1600000)
        {
        LPC_GPIO_PORT->DIRSET0= 1<<(LED_RED);

        LPC_GPIO_PORT->CLR0= 1<<(LED_RED);
        }
        if(count>1600000&&count<2000000)
        {
        LPC_GPIO_PORT->DIRSET0= 1<<(LED_RED);

        LPC_GPIO_PORT->SET0= 1<<(LED_RED);
        }

 

I need to know is there any other way to set the port pin to input and output[high/low] using other

peripheral gpio pins?

 

The problem is I need to 2 ports which I should configure to input and output, and direct those pins to

data pins[D4-D7], and control pins[RS, RW, EN] to interface the LCD.

 

Please suggest.

Outcomes