BARE METAL FRDM-KL25Z Port D enable for LCD

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

BARE METAL FRDM-KL25Z Port D enable for LCD

Jump to solution
1,744 Views
garabito
Contributor III

I try to use a LCD with the PORT D, but the problem is when i use the port D[0], it turn the blue led for LED RGB and the port D[0] on LCD didn't send nothing, so how can i enable only the PORT D for use the LCD?

This is part of my code

  1. void LCD_init(void)
  2. {
  3.     SIM->SCGC5    |=    0x1000;            /*    enable    clock    to    Port    D    */
  4.     PORTD->PCR[0]    =    0x100;      /*    make    PTD0    pin    as    GPIO    for LCD DB0*/
  5.     PORTD->PCR[1]    =    0x100;        /*    make    PTD1    pin    as    GPIO   for LCD DB1 */
  6.     PORTD->PCR[2]    =    0x100;        /*    make    PTD2    pin    as    GPIO    for LCD DB2*/
  7.     PORTD->PCR[3]    =    0x100;        /*    make    PTD3    pin    as    GPIO    for LCD DB3*/
  8.     PORTD->PCR[4]    =    0x100;        /*    make    PTD4    pin    as    GPIO    for LCD DB4*/
  9.     PORTD->PCR[5]    =    0x100;        /*    make    PTD5    pin    as    GPIO    for LCD DB5*/
  10.     PORTD->PCR[6]    =    0x100;        /*    make    PTD6    pin    as    GPIO    for LCD DB6*/
  11.     PORTD->PCR[7]    =    0x100;        /*    make    PTD7    pin    as    GPIO    for LCD DB7*/
  12.     PTD->PDDR    =    0xFF;            /*    make    PTD7-0    as    output    pins    */
  13.     SIM->SCGC5    |=    0x0200;            /*    enable    clock    to    Port    A    */
  14.     PORTA->PCR[2]    =    0x100;        /*    make    PTA2    pin    as    GPIO    for LCD RS*/
  15.     PORTA->PCR[4]    =    0x100;        /*    make    PTA4    pin    as    GPIO    for LCD RW*/
  16.     PORTA->PCR[5]    =    0x100;        /*    make    PTA5    pin    as    GPIO    for LCD E*/
  17.     PTA->PDDR    |=    0x34;            /*    make    PTA5,    4,    2    as    output    pins    */
  18.     delayMs(20);                    /*    initialization    sequence    */
  19.     LCD_command_noWait(0x30);        /*    LCD    does    not    respond    to    status    poll    */
  20.     delayMs(5);
  21.     LCD_command_noWait(0x30);
  22.     delayMs(1);
  23.     LCD_command_noWait(0x30);
  24.     LCD_command(0x38);                /*    set    8-bit    data,    2-line,    5x7    font    */
  25.     LCD_command(0x06);                /*    move    cursor    right    */
  26.     LCD_command(0x01);                /*    clear    screen,    move    cursor    to    home    */
  27.     LCD_command(0x0F);                /*    turn    on    display,    cursor    blinking    */
  28. }

Thanks

Tags (1)
0 Kudos
1 Solution
987 Views
mjbcswitzerland
Specialist V

Hi

The blue LED on the FRDM-KL25Z is connected to PTD1 and not PTD0.

You haven't show any code that actually changes the PTD0 or PTD1 outputs so the problem can't be seen.

If you need to work with a character LCD and the FRDM-KL25Z there is a complete solution at: http://www.utasker.com/kinetis/FRDM-KL25Z.html - fully documented at http://www.utasker.com/docs/uTasker/uTaskerLCD.PDF and including accurate simulation of the KL25 and LCD.

Regards

Mark

View solution in original post

0 Kudos
2 Replies
988 Views
mjbcswitzerland
Specialist V

Hi

The blue LED on the FRDM-KL25Z is connected to PTD1 and not PTD0.

You haven't show any code that actually changes the PTD0 or PTD1 outputs so the problem can't be seen.

If you need to work with a character LCD and the FRDM-KL25Z there is a complete solution at: http://www.utasker.com/kinetis/FRDM-KL25Z.html - fully documented at http://www.utasker.com/docs/uTasker/uTaskerLCD.PDF and including accurate simulation of the KL25 and LCD.

Regards

Mark

0 Kudos
988 Views
garabito
Contributor III

This is to embarrassing , but the problem was in the hardware, today I and change the protoboard and it worked. Any way, thanks for the links, I will check it.

Thanks

0 Kudos