Pages: [1]   Go Down
Author Topic: how to wire LCD with SPI  (Read 504 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

HI, guys.
I have one question about how to wire up LCD to Arduino
In my project, I connect MCP4822 with Arduino through SPI. So pin 12 and pin 10 are used for Arduino. Now I want to use LCD to show the output current. But Most of tutorials show the LCD using 12-10 for RS and RW. So I want to know could I use Pin 1-3 instead of pin 12-10.
I just want to make sure this.
Thanks
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 437
Posts: 23688
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If you are not using Pin 13 for SCK, then you are not using SPI.
Maybe faking it with software SPI.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you are not using Pin 13 for SCK, then you are not using SPI.
Maybe faking it with software SPI.
I mean it looks like they are conflict with each other
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 437
Posts: 23688
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

With SPI, pins 13-12-11 are connected to all devices. Unique Slave Select pins are used to enable one device at a time.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

United Kingdom
Offline Offline
Tesla Member
***
Karma: 220
Posts: 6587
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

With SPI, pins 13-12-11 are connected to all devices. Unique Slave Select pins are used to enable one device at a time.

If you are using a ST7920-based graphic LCD, then unfortunately it does not have a CS input. This means that it cannot share the SPI pins with another device. Here are a few solutions:

1. Drive one of the devices using software SPI. The ST7920 can be drive using ShiftOut, although ShiftOut is unnecessarily slow, and it'e easy to write a faster version.

2. If you are not using the UART, you can use the UART in SPI mode to get a second SPI channel.

3. Use an external and-gate to gate the clock to the ST7920.

However, if it's a text LCD (which uses about 5 other pins as well), then you can use any pins you like for RS and RW.
« Last Edit: November 03, 2012, 01:53:34 pm by dc42 » Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Pages: [1]   Go Up
Jump to: