element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • 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 1613 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
Parents
  • 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
Reply
  • 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
Children
No Data
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