craigc

LCD trouble using axiom's CSMB12 with PBMCUSLK

Discussion created by craigc on Oct 6, 2011
Latest reply on Oct 18, 2011 by bigmac

PLEASE HELP!!!

 

I am extremely frustrated. I'm a student who's professor doesn't care to teach us how to do this. I have been unable to display to the 8x2 lcd screen included with the PBMCUSLK AXM-0392 REV D Development board. i'm using axiom's CSMB12 daughter board. the microcontroller is the MC9S12DT256MFUE.

 

From what i've discovered so far:

The lcd uses the SPI interface. It is driven by a serial to parallel shift register 74HC595D. It requires that the LCD_EN jumpers be installed and the SS_SEL Jumper to be connecting SS* instead of GPIO. Axioms CSMB12 board labels the MOSI0,MISO0,SCK0,and SS0 as PM<#> which leads one to believe that it is connected to Port M, but the microcontroller datasheet shows these connecting to Port S.

 

I set up the registers and used some example code from my text to try and write a character to the lcd screen. 

 

void main{

 // Initialize the spi interface

openspi0(void);

 

for(;:smileywink:{    

putcspi0('H');       

delay1ms(1);}     

 

for(;:smileywink:{  } /* loop forever */ 

/* please make sure that you never leave main */

}

//Here is the function to set up the spi registers.

void openspi0(void){ 

SPI0BR = 0x10;                  // set baud rate   

SPI0CR1 = 0x50;                 // enable SPI, data shift on SCK’s rising edge, master mode   

SPI0CR2 = 0x02;                 // disable bidirectional mode, SPI stops in wait mode   

WOMS = 0x00;                    // enable Port S pull-up   

DDRS = 0xE2;

}

 

// Function to desplay a character.

void putcspi0 (char cx){   

char temp;       

while(!(SPI0SR & 0x20));        // wait until write is permissible   

SPI0DR = cx;                    // output the byte to the SPI   

while(!(SPI0SR & 0x80));         // wait until write operation is complete   

temp = SPI0DR;                  // clear the SPIF flag

}

 

 

Thanks in advance for the help!

Outcomes