Jump to content
emailcausey

SPI_write8

Recommended Posts

I am trying to get the Nokia 5110 lcd to work on the C2000 LaunchPad. I am running the code from this forum: http://www.forum.c2kcentral.com/topic/139-hardware-spi-working-with-the-nokia-5110-lcd/ and I get the error, "unresolved symbol _SPI_write8, first referenced in ./nokia5110.obj". I went to the nokia source file nokia5110.c and changed SPI_write8 to SPI_write. The program now loads, but nothing shows up on the lcd. I have attached the files from the website. Any ideas? Can anyone else get this to work? Seems like it should...

ti.h

nokia5110.h

nokia5110.c

main.c

font8x8.h

Share this post


Link to post
Share on other sites

It looks like you're on the right track.

 

Given that you're using Tim's code, I would suspect a wiring error.  Can you double check all of your wires?  Reset and the Chip enable/select are two very important lines that could cause this to fail.  But it could also be any of the serial data lines.

 

Does the backlight of the LCD come on when you run it?  From what I see in the code, if its wired correctly it should turn on even if the communications aren't fully working.

Share this post


Link to post
Share on other sites

I double checked the wire connections. It seems pretty straightforward. I have also attached a simple wire diagram. It is strange that the LCD lights up when I debug the program, but when I hit the resume button the backlight turns off. SInce SPI chips only support messages that are multiples of 8 bits could it be that by changing SPI_Write8 to SPI_Write I am preventing the transfer of data?

post-1078-14264717218964_thumb.jpg

Share this post


Link to post
Share on other sites

Hi

If you changed the function to the SPI_Write function then you are not transmitting the correct data.

 

The SPITXBUF is 16 bits wide and the data has to be shifted to the left 8 bits for the lcd to see the transmission.

The Nokia 5110 lcd is looking for an 8 bit transmission, I know you can send more than 8 bits per transmission , but thats a different topic.

 

For example if you want to send 0x21(0010 0001). When the SPITXBUF register gets loaded it looks like this 0x0021(0000 0000 0010 0001).

When you use the SPI_Write function in this situation the lcd sees the 1st 8 bits (the zeros).

 

When you use the SPI_Write8 function the 0x0021 gets shifted << to the left 8 times and ends up looking like 0x2100(0010 0001 0000 0000).

Now the lcd sees the 0x21 as it was intended.

 

I think your on the right track, you need to find the header file (spi.h) with the SPI_Write8 function in it and use that, as explained in the other thread.

http://www.forum.c2kcentral.com/topic/139-hardware-spi-working-with-the-nokia-5110-lcd/

 

Hope this helps

Tim

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...