Go Down

Topic: how to wire LCD with SPI (Read 664 times) previous topic - next topic

rockyli1989

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

CrossRoads

If you are not using Pin 13 for SCK, then you are not using SPI.
Maybe faking it with software SPI.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

rockyli1989


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

CrossRoads

With SPI, pins 13-12-11 are connected to all devices. Unique Slave Select pins are used to enable one device at a time.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

dc42

#4
Nov 03, 2012, 07:50 pm Last Edit: Nov 03, 2012, 07:53 pm by dc42 Reason: 1

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

Go Up