element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Freedom development platform
  • Products
  • Dev Tools
  • Freedom development platform
  • More
  • Cancel
Freedom development platform
Forum FRDM-K64F + KSDK SOFTWARE:How to light up a LCD screen display Chinese characters
  • Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Freedom development platform to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 8 replies
  • Subscribers 7 subscribers
  • Views 1451 views
  • Users 0 members are here
  • :unable
  • lcd
  • to
  • display
  • error
  • character
Related

FRDM-K64F + KSDK SOFTWARE:How to light up a LCD screen display Chinese characters

Former Member
Former Member over 10 years ago

The LCD panel model:LM6060CBY

I want to use the gpio port initialization LCD pin,but i don't know why is the LCD screen is couldn't show Chinese characters, don't know whether I drive call errors, hope everybody to help me look at it.


Below is the LCD initialization code:

 

void initLCDM(void)

{

   uint8_t  ContrastLevel=0x2c;      // default Contrast Level

 

GPIO_DRV_Init(NULL,lcdpins);//gpio initialization :GPIO_DRV_Init(const gpio_input_pin_user_config_t * inputPins,const gpio_output_pin_user_config_t * outputPins)

 

    configure_lcd_pins(0);//gpio Pin reuse

 

  

  GPIO_DRV_WritePinOutput(kLCDCS, 1);

  GPIO_DRV_WritePinOutput(kLCDRST,1);

  GPIO_DRV_WritePinOutput(kLCDA0, 1);

  GPIO_DRV_WritePinOutput(kLCDWR, 1);

  GPIO_DRV_WritePinOutput(kLCDRD, 1);

  GPIO_DRV_WritePinOutput(kLCDD0, 1);

GPIO_DRV_WritePinOutput(kLCDD1, 1);

GPIO_DRV_WritePinOutput(kLCDD2, 1);

  GPIO_DRV_WritePinOutput(kLCDD3, 1);

  GPIO_DRV_WritePinOutput(kLCDD4, 1);

  GPIO_DRV_WritePinOutput(kLCDD5, 1);

  GPIO_DRV_WritePinOutput(kLCDD6, 1);

  GPIO_DRV_WritePinOutput(kLCDD7, 1);

GPIO_DRV_WritePinOutput(kLCDVC, 1);

GPIO_DRV_WritePinOutput(kLCDVD, 1);

 

 

GPIO_DRV_WritePinOutput(kLCDRST, 1);

GPIO_DRV_WritePinOutput(kLCDRST, 0);

GPIO_DRV_WritePinOutput(kLCDRST, 1);

 

 

  SdCmd(0xaf);            // display on

  SdCmd(0x40);            // display start line=0

   SdCmd(0xa0);            // ADC=0

   SdCmd(0xa6);            // normal display

 

 

   SdCmd(0xa4);            // Duisplay all point = off

   SdCmd(0xa2);            // LCD bias = 1/9

   SdCmd(0xc8);            // Common output mode select= reverse

   SdCmd(0x2f);            // Power control = all on

 

 

  SdCmd(0x25); // LCD(G-mode) use internal Rb/Ra;

 

 

/********************Modify booster multiple f801(5x)->f800***********/

    SdCmd(0xf8);            // Booster Ratio = 4x

    SdCmd(0x00);            // (two byte command)

/********************************************************************/

   SdCmd(0x81);            // E-Vol setting

    SdCmd(ContrastLevel);   // (2byte command)

   Display_Clear();

  

}

 

 

const gpio_output_pin_user_config_t lcdpins[] = {

  {

   .pinName = kLCDCS,

  .config.outputLogic = 0,

  .config.slewRate = kPortFastSlewRate,

  .config.driveStrength = kPortHighDriveStrength,

  //.config.interrupt = kPortIntDisabled,

   },

  {

   .pinName = kLCDRST,

  .config.outputLogic = 0,

  .config.slewRate = kPortFastSlewRate,

  .config.driveStrength = kPortHighDriveStrength,

   },

  {

   .pinName = kLCDA0,

  .config.outputLogic = 0,

  .config.slewRate = kPortFastSlewRate,

  .config.driveStrength = kPortHighDriveStrength,

   },

  {

   .pinName = kLCDWR,

  .config.outputLogic = 0,

  .config.slewRate = kPortFastSlewRate,

  .config.driveStrength = kPortHighDriveStrength,

   },

  {

   .pinName = kLCDRD,

  .config.outputLogic = 0,

  .config.slewRate = kPortFastSlewRate,

  .config.driveStrength = kPortHighDriveStrength,

   },

  {

   .pinName = kLCDD0,

  .config.outputLogic = 0,

  .config.slewRate = kPortFastSlewRate,

  .config.driveStrength = kPortHighDriveStrength,

   },

  {

   .pinName = kLCDD1,

  .config.outputLogic = 0,

  .config.slewRate = kPortFastSlewRate,

  .config.driveStrength = kPortHighDriveStrength,

   },

  {

   .pinName = kLCDD2,

  .config.outputLogic = 0,

  .config.slewRate = kPortFastSlewRate,

  .config.driveStrength = kPortHighDriveStrength,

   },

  {

   .pinName = kLCDD3,

  .config.outputLogic = 0,

  .config.slewRate = kPortFastSlewRate,

  .config.driveStrength = kPortHighDriveStrength,

   },

  {

   .pinName = kLCDD4,

  .config.outputLogic = 0,

  .config.slewRate = kPortFastSlewRate,

  .config.driveStrength = kPortHighDriveStrength,

   },

  {

   .pinName = kLCDD5,

  .config.outputLogic = 0,

  .config.slewRate = kPortFastSlewRate,

  .config.driveStrength = kPortHighDriveStrength,

   },

  {

   .pinName = kLCDD6,

  .config.outputLogic = 0,

  .config.slewRate = kPortFastSlewRate,

  .config.driveStrength = kPortHighDriveStrength,

   },

  {

   .pinName = kLCDD7,

  .config.outputLogic = 0,

  .config.slewRate = kPortFastSlewRate,

  .config.driveStrength = kPortHighDriveStrength,

   },

  {

   .pinName = kLCDVC,

  .config.outputLogic = 0,

  .config.slewRate = kPortFastSlewRate,

  .config.driveStrength = kPortHighDriveStrength,

   },

  {

   .pinName = kLCDVD,

  .config.outputLogic = 0,

  .config.slewRate = kPortFastSlewRate,

  .config.driveStrength = kPortHighDriveStrength,

   },

  

  {

    .pinName = GPIO_PINS_OUT_OF_RANGE,

   }

  

};

 

//lcdÒý½Å¸´ÓÃ

void configure_lcd_pins(uint32_t instance)

{

  PORT_HAL_SetMuxMode(PORTB_BASE,18U,kPortMuxAsGpio);

  PORT_HAL_SetMuxMode(PORTC_BASE,16U,kPortMuxAsGpio);

  PORT_HAL_SetMuxMode(PORTB_BASE,19U,kPortMuxAsGpio);

  PORT_HAL_SetMuxMode(PORTC_BASE,17U,kPortMuxAsGpio);

  PORT_HAL_SetMuxMode(PORTC_BASE,1U,kPortMuxAsGpio);

  PORT_HAL_SetMuxMode(PORTB_BASE,9U,kPortMuxAsGpio);

  PORT_HAL_SetMuxMode(PORTC_BASE,8U,kPortMuxAsGpio);

  PORT_HAL_SetMuxMode(PORTA_BASE,1U,kPortMuxAsGpio);

  PORT_HAL_SetMuxMode(PORTC_BASE,9U,kPortMuxAsGpio);

  PORT_HAL_SetMuxMode(PORTB_BASE,23U,kPortMuxAsGpio);

  PORT_HAL_SetMuxMode(PORTC_BASE,0U,kPortMuxAsGpio);

  PORT_HAL_SetMuxMode(PORTA_BASE,2U,kPortMuxAsGpio);

  PORT_HAL_SetMuxMode(PORTC_BASE,7U,kPortMuxAsGpio);

  PORT_HAL_SetMuxMode(PORTC_BASE,2U,kPortMuxAsGpio);

  PORT_HAL_SetMuxMode(PORTC_BASE,5U,kPortMuxAsGpio);

 

 

}

 

 

//write 12864LCD command

void SdCmd(uint8_t Command)   //send command

{  

 

 

    GPIO_DRV_WritePinOutput(kLCDA0, 0);

    GPIO_DRV_WritePinOutput(kLCDWR, 1);

    GPIO_DRV_WritePinOutput(kLCDRD, 1);

 

 

  if((Command & 0x01) ==0)

   GPIO_DRV_WritePinOutput(kLCDD0, 0);

  else

  GPIO_DRV_WritePinOutput(kLCDD0, 1);

 

  if((Command & 0x02) ==0)

    GPIO_DRV_WritePinOutput(kLCDD1, 0);

  else

  GPIO_DRV_WritePinOutput(kLCDD1, 1);

 

  if((Command & 0x04) ==0)

    GPIO_DRV_WritePinOutput(kLCDD2, 0);

  else

   GPIO_DRV_WritePinOutput(kLCDD2, 1);

 

  if((Command & 0x08) ==0)

     GPIO_DRV_WritePinOutput(kLCDD3, 0);

  else

     GPIO_DRV_WritePinOutput(kLCDD3, 1); 

 

  if((Command & 0x10) ==0)

     GPIO_DRV_WritePinOutput(kLCDD4, 0);

  else

    GPIO_DRV_WritePinOutput(kLCDD4, 1);

 

  if((Command & 0x20) ==0)

    GPIO_DRV_WritePinOutput(kLCDD5, 0);

  else

     GPIO_DRV_WritePinOutput(kLCDD5, 1);

 

  if((Command & 0x40) ==0)

     GPIO_DRV_WritePinOutput(kLCDD6, 0);

  else

    GPIO_DRV_WritePinOutput(kLCDD6, 1);

 

  if((Command & 0x80) ==0)

     GPIO_DRV_WritePinOutput(kLCDD7, 0);

  else

     GPIO_DRV_WritePinOutput(kLCDD7, 1);

 

   GPIO_DRV_WritePinOutput(kLCDCS, 0);

  GPIO_DRV_WritePinOutput(kLCDWR, 0);

  GPIO_DRV_WritePinOutput(kLCDWR, 1);

  GPIO_DRV_WritePinOutput(kLCDCS, 1);

 

}

 

//send data

void SdData(uint8_t DData)          

{

 

    GPIO_DRV_WritePinOutput(kLCDA0, 1);

    GPIO_DRV_WritePinOutput(kLCDWR, 1);

    GPIO_DRV_WritePinOutput(kLCDRD, 1);

 

 

  if((DData & 0x01) ==0)

   GPIO_DRV_WritePinOutput(kLCDD0, 0);

  else

  GPIO_DRV_WritePinOutput(kLCDD0, 1);

 

  if((DData & 0x02) ==0)

    GPIO_DRV_WritePinOutput(kLCDD1, 0);

  else

  GPIO_DRV_WritePinOutput(kLCDD1, 1);

 

  if((DData & 0x04) ==0)

    GPIO_DRV_WritePinOutput(kLCDD2, 0);

  else

   GPIO_DRV_WritePinOutput(kLCDD2, 1);

 

  if((DData & 0x08) ==0)

     GPIO_DRV_WritePinOutput(kLCDD3, 0);

  else

     GPIO_DRV_WritePinOutput(kLCDD3, 1); 

 

  if((DData & 0x10) ==0)

     GPIO_DRV_WritePinOutput(kLCDD4, 0);

  else

    GPIO_DRV_WritePinOutput(kLCDD4, 1);

 

  if((DData & 0x20) ==0)

    GPIO_DRV_WritePinOutput(kLCDD5, 0);

  else

     GPIO_DRV_WritePinOutput(kLCDD5, 1);

 

  if((DData & 0x40) ==0)

     GPIO_DRV_WritePinOutput(kLCDD6, 0);

  else

    GPIO_DRV_WritePinOutput(kLCDD6, 1);

 

  if((DData & 0x80) ==0)

     GPIO_DRV_WritePinOutput(kLCDD7, 0);

  else

     GPIO_DRV_WritePinOutput(kLCDD7, 1);

 

   GPIO_DRV_WritePinOutput(kLCDCS, 0);

  GPIO_DRV_WritePinOutput(kLCDWR, 0);

  GPIO_DRV_WritePinOutput(kLCDWR, 1);

  GPIO_DRV_WritePinOutput(kLCDCS, 1);

 

}

 

 

//display

void Display_ASCII(uint8_t Font,uint8_t Nor_Inv_Cur,uint8_t Char, uint8_t X, uint8_t Y)

{

  uint16_t ASCII_Index; 

  uint8_t row;   //ÐÐ

  uint8_t Addr_Page,column_low, column_hight;

  uint8_t k;

  Addr_Page=0;

  k=0;

  if(Font == 1)

      {

    ASCII_Index=(Char-0x20)<<4;

    Addr_Page=X|0xb0;

 

 

    column_hight=((Y>>1)&0x0F)|0x10;

    column_low=(Y<<3)&0x0F;

   

    SdCmd(Addr_Page);     //ÉϰëÒ³

    SdCmd(column_hight);

    SdCmd(column_low);

 

    for (row=0; row<8; row++)

     {

   k=chardot_8x16[ASCII_Index++];

  if(Nor_Inv_Cur==1)k=~k;

   SdData(k);

  }

 

  SdCmd(Addr_Page+1);    //ϰëÒ³

  SdCmd(column_hight);   //µ÷ÊԵ㣬ÊÇ·ñÐèÒªÖØÉècolumn£¬Ò²¼´¿ÉÖªµÀcolumn address counterÊÇ·ñ×Ô¼º×ÔÔö

    SdCmd(column_low);

 

  for (row=8; row<16; row++)

  {

  k=chardot_8x16[ASCII_Index++];

  if(Nor_Inv_Cur==1)k=~k;

  SdData(k);

  }   

      }

     

    else  //En_5x8   5x8×Ö¿â¸ñʽÐè¸Ä

      {

  ASCII_Index=(Char-0x20)*5;

      Addr_Page=X|0xb0;

      column_hight=((Y>>1)&0x0F)|0x10;

      column_low=(Y<<3)&0x0F;

     

      SdCmd(Addr_Page);

  SdCmd(column_hight);

  SdCmd(column_low);

      for (row=0; row<5; row++)SdData(chardot_5x8[ASCII_Index++]);

  //     for (row=0; row<5; row++)SdData(0x00);       

       }

}

 

int  main (void)

 

 

{ 

   OSA_Init();                                                 /* Init uC/OS-II.                                       */

    initLCDM();

    

Display_ASCII(1,0,0x36,4,2);

OSA_Start();                                                /* Start multitasking (i.e. give control to uC/OS-II).  */

 

 

    while (DEF_ON) {                                            /* Should Never Get Here                                */

        ;

    }

 

 

} 

  • Sign in to reply
  • Cancel

Top Replies

  • element14jamie
    element14jamie over 10 years ago +1
    Hello, I will move this over to the Freescale Freedom area, as it is a better fit Thank you, Jamie
  • clem57
    clem57 over 10 years ago

    Can this be posted in K64F forum element14jamie?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • element14jamie
    element14jamie over 10 years ago

    Hello,

    I will move this over to the Freescale Freedom area, as it is a better fit

     

    Thank you,

     

    Jamie

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 10 years ago in reply to element14jamie

    I'm very sorry!I'll be careful next time。。。

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • clem57
    clem57 over 10 years ago in reply to Former Member

    Ni Hoa http://www.element14.com/community/people/%E9%BB%A7%E9%BB%91%E4%B8%AD%E7%9A%84%E6%B5%81%E8%90%A4

       I speak a little Chinese. But as I understand LCD, they have built in Roman characters, but not Chinese characters. Therefore you would need to turn on dots and not use Display_ASCII(1,0,0x36,4,2);

    Clem

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 10 years ago in reply to clem57

    I thank you very much for your answer.According to you I tried again and found that the LCD panel will not show anything.

    The following figure, I want to initialize the use of the gpio port as 6060 LCD screen, call KSDK own gpio driver in software initialization and assignment of the pin, but don't know why I just can't show, don't know if I use gpio driver problem..

     

    This is the KSDK gpio port driver:


    #include "fsl_gpio_driver.h"

    #include "fsl_clock_manager.h"

    #include "fsl_interrupt_manager.h"

     

     

    /*******************************************************************************

    * Variables

    ******************************************************************************/

     

     

    /*******************************************************************************

    * Code

    ******************************************************************************/

     

     

    /*FUNCTION**********************************************************************

    *

    * Function Name : GPIO_DRV_Init

    * Description   : Initialize all GPIO pins used by board.

    * To initialize the GPIO driver, two arrays similar with

    * gpio_input_pin_user_config_t inputPin[] and

    * gpio_output_pin_user_config_t outputPin[] should be defined in user's file.

    * Then simply call GPIO_DRV_Init() and pass into these two arrays. If input

    * or output pins is not needed, pass in a NULL.

    *

    *END**************************************************************************/

    void GPIO_DRV_Init(const gpio_input_pin_user_config_t * inputPins,

                       const gpio_output_pin_user_config_t * outputPins)

    {

        if (inputPins)

        {

            /* Initialize input pins.*/

            while (inputPins->pinName != GPIO_PINS_OUT_OF_RANGE)

            {

                GPIO_DRV_InputPinInit(inputPins++);

            }

        }

     

     

        if (outputPins)

        {

            /* Initialize output pins.*/

            while (outputPins->pinName != GPIO_PINS_OUT_OF_RANGE)

            {

                GPIO_DRV_OutputPinInit(outputPins++);

            }

        }

    }

     

     

    /*FUNCTION**********************************************************************

    *

    * Function Name : GPIO_DRV_InputPinInit

    * Description   : Initialize one GPIO input pin used by board.

    *

    *END**************************************************************************/

    void GPIO_DRV_InputPinInit(const gpio_input_pin_user_config_t *inputPin)

    {

        /* Get actual port and pin number.*/

        uint32_t port = GPIO_EXTRACT_PORT(inputPin->pinName);

        uint32_t pin = GPIO_EXTRACT_PIN(inputPin->pinName);

        uint32_t gpioBaseAddr = g_gpioBaseAddr[port];

        uint32_t portBaseAddr = g_portBaseAddr[port];

     

     

        /* Un-gate port clock*/

        CLOCK_SYS_EnablePortClock(port);

     

     

        /* Set current pin as digital input.*/

        GPIO_HAL_SetPinDir(gpioBaseAddr, pin, kGpioDigitalInput);

     

     

        /* Configure GPIO input features. */

        #if FSL_FEATURE_PORT_HAS_PULL_SELECTION

        PORT_HAL_SetPullCmd(portBaseAddr, pin, inputPin->config.isPullEnable);

        PORT_HAL_SetPullMode(portBaseAddr, pin, inputPin->config.pullSelect);

        #endif

        #if FSL_FEATURE_PORT_HAS_PASSIVE_FILTER 

        PORT_HAL_SetPassiveFilterCmd(portBaseAddr, pin,

                inputPin->config.isPassiveFilterEnabled);

        #endif

        #if FSL_FEATURE_PORT_HAS_DIGITAL_FILTER

        PORT_HAL_SetDigitalFilterCmd(portBaseAddr, pin,

                inputPin->config.isDigitalFilterEnabled);

        #endif

        #if FSL_FEATURE_GPIO_HAS_INTERRUPT_VECTOR

        PORT_HAL_SetPinIntMode(portBaseAddr, pin, inputPin->config.interrupt);

     

     

        /* Configure NVIC */

        if ((inputPin->config.interrupt) && (g_portIrqId[port]))

        {

            /* Enable GPIO interrupt.*/

            INT_SYS_EnableIRQ(g_portIrqId[port]);

        }

        #endif

    }

     

     

    /*FUNCTION**********************************************************************

    *

    * Function Name : GPIO_DRV_OutputPinInit

    * Description   : Initialize one GPIO output pin used by board.

    *

    *END**************************************************************************/

    void GPIO_DRV_OutputPinInit(const gpio_output_pin_user_config_t *outputPin)

    {

        /* Get actual port and pin number.*/

        uint32_t port = GPIO_EXTRACT_PORT(outputPin->pinName);

        uint32_t pin = GPIO_EXTRACT_PIN(outputPin->pinName);

        uint32_t gpioBaseAddr = g_gpioBaseAddr[port];

        uint32_t portBaseAddr = g_portBaseAddr[port];

     

     

        /* Un-gate port clock*/

        CLOCK_SYS_EnablePortClock(port);

     

     

        /* Set current pin as digital output.*/

        GPIO_HAL_SetPinDir(gpioBaseAddr, pin, kGpioDigitalOutput);

     

     

        /* Configure GPIO output features. */

        GPIO_HAL_WritePinOutput(gpioBaseAddr, pin, outputPin->config.outputLogic);

        #if FSL_FEATURE_PORT_HAS_SLEW_RATE

        PORT_HAL_SetSlewRateMode(portBaseAddr, pin, outputPin->config.slewRate);

        #endif

        #if FSL_FEATURE_PORT_HAS_DRIVE_STRENGTH

        PORT_HAL_SetDriveStrengthMode(portBaseAddr, pin, outputPin->config.driveStrength);

        #endif

        #if FSL_FEATURE_PORT_HAS_OPEN_DRAIN

        PORT_HAL_SetOpenDrainCmd(portBaseAddr, pin, outputPin->config.isOpenDrainEnabled);

        #endif

    }

     

     

    /*FUNCTION**********************************************************************

    *

    * Function Name : GPIO_DRV_GetPinDir

    * Description   : Get current direction of individual GPIO pin.

    *

    *END**************************************************************************/

    gpio_pin_direction_t GPIO_DRV_GetPinDir(uint32_t pinName)

    {

        uint32_t gpioBaseAddr = g_gpioBaseAddr[GPIO_EXTRACT_PORT(pinName)];

        uint32_t pin = GPIO_EXTRACT_PIN(pinName);

     

     

        return GPIO_HAL_GetPinDir(gpioBaseAddr, pin);

    }

     

     

    /*FUNCTION**********************************************************************

    *

    * Function Name : GPIO_DRV_SetPinDir

    * Description   : Set current direction of individual GPIO pin.

    *

    *END**************************************************************************/

    void GPIO_DRV_SetPinDir(uint32_t pinName, gpio_pin_direction_t direction)

    {

        uint32_t gpioBaseAddr = g_gpioBaseAddr[GPIO_EXTRACT_PORT(pinName)];

        uint32_t pin = GPIO_EXTRACT_PIN(pinName);

     

     

        GPIO_HAL_SetPinDir(gpioBaseAddr, pin, direction);

    }

     

     

    /*FUNCTION**********************************************************************

    *

    * Function Name : GPIO_DRV_WritePinOutput

    * Description   : Set output level of individual GPIO pin to logic 1 or 0.

    *

    *END**************************************************************************/

    void GPIO_DRV_WritePinOutput(uint32_t pinName, uint32_t output)

    {

        uint32_t gpioBaseAddr = g_gpioBaseAddr[GPIO_EXTRACT_PORT(pinName)];

        uint32_t pin = GPIO_EXTRACT_PIN(pinName);

     

     

        GPIO_HAL_WritePinOutput(gpioBaseAddr, pin, output);

    }

     

     

    /*FUNCTION**********************************************************************

    *

    * Function Name : GPIO_DRV_SetPinOutput

    * Description   : Set output level of individual GPIO pin to logic 1.

    *

    *END**************************************************************************/

    void GPIO_DRV_SetPinOutput(uint32_t pinName)

    {

        uint32_t gpioBaseAddr = g_gpioBaseAddr[GPIO_EXTRACT_PORT(pinName)];

        uint32_t pin = GPIO_EXTRACT_PIN(pinName);

     

     

        GPIO_HAL_SetPinOutput(gpioBaseAddr, pin);

    }

     

     

    /*FUNCTION**********************************************************************

    *

    * Function Name : GPIO_DRV_ClearPinOutput

    * Description   : Set output level of individual GPIO pin to logic 0.

    *

    *END**************************************************************************/

    void GPIO_DRV_ClearPinOutput(uint32_t pinName)

    {

        uint32_t gpioBaseAddr = g_gpioBaseAddr[GPIO_EXTRACT_PORT(pinName)];

        uint32_t pin = GPIO_EXTRACT_PIN(pinName);

     

        GPIO_HAL_ClearPinOutput(gpioBaseAddr, pin);

    }

     

     

    /*FUNCTION**********************************************************************

    *

    * Function Name : GPIO_DRV_TogglePinOutput

    * Description   : Reverse current output logic of individual GPIO pin.

    *

    *END**************************************************************************/

    void GPIO_DRV_TogglePinOutput(uint32_t pinName)

    {

        uint32_t gpioBaseAddr = g_gpioBaseAddr[GPIO_EXTRACT_PORT(pinName)];

        uint32_t pin = GPIO_EXTRACT_PIN(pinName);

     

        GPIO_HAL_TogglePinOutput(gpioBaseAddr, pin);

    }

     

     

    /*FUNCTION**********************************************************************

    *

    * Function Name : GPIO_DRV_ReadPinInput

    * Description   : Read current input value of individual GPIO pin.

    *

    *END**************************************************************************/

    uint32_t GPIO_DRV_ReadPinInput(uint32_t pinName)

    {

        uint32_t gpioBaseAddr = g_gpioBaseAddr[GPIO_EXTRACT_PORT(pinName)];

        uint32_t pin = GPIO_EXTRACT_PIN(pinName);

      

        return GPIO_HAL_ReadPinInput(gpioBaseAddr, pin);

    }

     

     

    #if FSL_FEATURE_PORT_HAS_DIGITAL_FILTER

    /*FUNCTION**********************************************************************

    *

    * Function Name : GPIO_DRV_SetDigitalFilterCmd

    * Description   : Enable or disable digital filter in one single port.

    *

    *END**************************************************************************/

    void GPIO_DRV_SetDigitalFilterCmd(uint32_t pinName, bool isDigitalFilterEnabled)

    {

        uint32_t portBaseAddr = g_portBaseAddr[GPIO_EXTRACT_PORT(pinName)];

        uint32_t pin = GPIO_EXTRACT_PIN(pinName);

     

        PORT_HAL_SetDigitalFilterCmd(portBaseAddr, pin, isDigitalFilterEnabled);

    }

    #endif

     

     

    /*FUNCTION**********************************************************************

    *

    * Function Name : GPIO_DRV_ClearPinIntFlag

    * Description   : Clear individual GPIO pin interrupt status flag.

    *

    *END**************************************************************************/

    void GPIO_DRV_ClearPinIntFlag(uint32_t pinName)

    {

        uint32_t portBaseAddr = g_portBaseAddr[GPIO_EXTRACT_PORT(pinName)];

        uint32_t pin = GPIO_EXTRACT_PIN(pinName);

     

        PORT_HAL_ClearPinIntFlag(portBaseAddr, pin);

    }

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 10 years ago in reply to clem57

    Thank you very much for your help, I have already successfully solve the problem.image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • clem57
    clem57 over 10 years ago in reply to Former Member

    Can I ask what thw solution was? Glad to hear that things are better

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Former Member
    Former Member over 10 years ago in reply to clem57

    Yes.LCD can't display the reason is that drive current is not enough, not my mistake of program, and I put the external LCD screen of the VC to GND pin two other power supply to it, rather than from a pin power development board.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube