Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Nokia 5110 LCD & 74hc595 on SPI?


  • Please log in to reply
5 replies to this topic

#1 tracstarr

tracstarr

    Member

  • Members
  • PipPip
  • 14 posts

Posted 29 October 2011 - 01:21 PM

I'm fairly new to the world of designing my own electronics. The current project I'm working on requires the use of the Nokia 5110 LCD along with controlling an array of leds. After doing some research I figured the 595 shift register would do the trick for the LEDs. However, as I continue to read and go over examples I realized that they both use the SPI. Since the lcd as a chip select that's perfect, however, does the latch pin on the 595 work the same way? I have a feeling it doesn't (don't have one to test with yet). That being said, what might I consider looking at to accomplish this. Considering that I don't have enough pins to directly connect all the leds to the netduino. Am I right to look at using the 595 or is there another chip that behaves as a true spi slave? thanks

#2 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 29 October 2011 - 02:46 PM

Hi tracstarr and welcome to the Netduino community! You could use both devices at the same time on the SPI bus (pins 11, 12 & 13) as long as they have a different CS-pin (latch/chip select/whatever name used). So you should be fine!
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#3 Stefan W.

Stefan W.

    Advanced Member

  • Members
  • PipPipPip
  • 153 posts

Posted 29 October 2011 - 03:44 PM

technically, the "latch pin" is something different than a "chip select" pin, and the usage as chip select is not quite correct - you'll notice that when you don't make full writes to the shift register (the shift registers still use the clock and data inputs even when you don't write to it, so if you don't use full writes on the shift registers you'll see garbage - if you always write all bits in the shift registers you won't notice).
I believe that no discovery of fact, however trivial, can be wholly useless to the race, and that no trumpeting of falsehood, however virtuous in intent, can be anything but vicious.
-- H.L. Mencken, "What I Believe"

#4 tracstarr

tracstarr

    Member

  • Members
  • PipPip
  • 14 posts

Posted 29 October 2011 - 04:08 PM

technically, the "latch pin" is something different than a "chip select" pin, and the usage as chip select is not quite correct - you'll notice that when you don't make full writes to the shift register (the shift registers still use the clock and data inputs even when you don't write to it, so if you don't use full writes on the shift registers you'll see garbage - if you always write all bits in the shift registers you won't notice).


Ok, that makes sense. So if I was using the SPI to write to the lcd those bytes would also be transferred into the 595, but unless I set latch, nothing will happen. But if I then stop writing to the lcd and want to use the 595, I have to make sure I set all 8 bits then set latch otherwise some old stuff from the lcd would be there. Am i correct?

Now, I've noticed this morning while looking at some other code that it looks like i can use the 595 on regular GPIO pins and use a software spi? Since I'm only wanting to control LEDs, and they won't change their state very often (possibly every few seconds, but more like minutes), that should also work fine as the slower speed shouldn't be a concern?

Also, when using SPI, other than pins 11-13, are any other pins reserved and not usable as GPIO? I get mixed signals reading some of the forms. It seems maybe pin 4?

Thanks again.

#5 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 30 October 2011 - 07:18 AM

Also, when using SPI, other than pins 11-13, are any other pins reserved and not usable as GPIO? I get mixed signals reading some of the forms. It seems maybe pin 4?

Pins 11, 12 and 13 form the SPI bus together. Pin 4 has a bug at the moment that's under research, all other pins are useable.
For pin 4, I wrote a MultiSPI class that helps supporting multiple SPI devices and it also fixes the pin 4 issue:
http://netmftoolbox....ew/10376#134132
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#6 Stefan W.

Stefan W.

    Advanced Member

  • Members
  • PipPipPip
  • 153 posts

Posted 30 October 2011 - 12:10 PM

Just to add: the bug occurs when you try to use pin 4 as a chip select pin, not when you try to use it as a GPIO, so as a GPIO you're fine with pin 4.
I believe that no discovery of fact, however trivial, can be wholly useless to the race, and that no trumpeting of falsehood, however virtuous in intent, can be anything but vicious.
-- H.L. Mencken, "What I Believe"




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.