Jump to content
Rei Vilo

[Energia Library] Nokia 5110 LCD BoosterPack/Breakout PCB

Recommended Posts

You're a master.

I have a project for a DDS signal generator using the LaunchPad, an AD9850 board and the 5110 display. My goal for today was to "try to talk" with the 5110 LCD. You saved me a lot of work!

Thanks a lot.

 

Yan.

Share this post


Link to post
Share on other sites

@Rei Vilo - two comments:

1. in example LCD_5110_SPI_main.ino for LM4F120H5QR (line 93)
command SPI.begin(2); sets ssPin to 2(PB_5) but above is set to PA_7.
Maybe this mean a spi bus number, but in this case we need set first:
SPI.setModule(2);
SPI.begin(PA_7); or SPI.begin(10);

 

BTW - maybe we also don't need to set:

pinMode(_pinChipSelect, OUTPUT);

inside LCD_5110_SPI.cpp->void LCD_5110_SPI::begin()...

because in SPI.cpp->void SPIClass::begin(uint8_t ssPin)

is set to OUTPUT too...

 

2. in LCD_5110_SPI.cpp
void LCD_5110_SPI::write(uint8_t dataCommand, uint8_t c) {
    digitalWrite(_pinDataCommand, dataCommand);
    
    digitalWrite(_pinChipSelect, LOW);
    SPI.transfer((char)c);
    digitalWrite(_pinChipSelect, HIGH);
}

I think it should look like:

void LCD_5110_SPI::write(uint8_t dataCommand, uint8_t c) {
    digitalWrite(_pinDataCommand, dataCommand);
    SPI.transfer(_pinChipSelect, (char)c);
}

because procedure SPI.transfer automatically sets ssPin to LOW before send data and
after sets ssPin to HIGH (of course if You dont set transferMode to SPI_CONTINUE :smile: )

 

I have tested this solution and it works properly with other device (nRF24L01+) in the same spi bus

Share this post


Link to post
Share on other sites

Thank for the feed-back and the useful comments. 

 

1. That's fixed now. 

 

Initialisation of _pinChipSelect is done line 72 of LCD_5110_SPI.cpp

 

void LCD_5110_SPI::begin() {
    pinMode(_pinChipSelect, OUTPUT);
    ...
}

 

 

2. I'm not sure to understand the comment.

 

As far as I've understood, the master SPI selects the slave it wants to talk to through _pinChipSelect.

 

SS is for slave select when SPI is in slave mode.

Share this post


Link to post
Share on other sites

about 2:

I think that the lines:

CS_LOW and CS_HIGH are not needed

when you replace SPI.transfer((char)c);

by another call: SPI.transfer(_pinChipSelect, (char)c);

which execute SPIClass::transfer(uint8_t ssPin, uint8_t data) -> SPIClass::transfer(uint8_t ssPin, uint8_t data, uint8_t transferMode)

where lines:

169 sets CS 5110 to LOW and

176 sets CS 5110 back to HIGH

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...