I am currently trying to add a MCP4131 to a board with a Topway LCD using the ST7565 Chipset.
I can Seperatly either use the LCD , Or only the MCP4131 via SPI
it Seems that the ST7565 Library is Clashing with the SPI Library.
Does anyone know a workaround for this..??
Please See my code below :
#include <ST7565.h> #include <SPI.h>
#define SS 18 #define LED 2 // LED connected to D2 Pin1(PD3)
void WritePot(int i);
// pin 4 - Serial data out (SID)
// pin 5 - Serial clock out (SCLK)
// pin 8 - Data/Command select (RS or A0)
// pin 9 - LCD reset (RST)
// pin 10 - LCD chip select (CS)
ST7565 glcd(4, 5, 8, 9, 10);
SurferTim:
This has been a week for shiftOut. ShiftOut will not work on the SPI bus pins after your sketch calls SPI.begin.
This is from the library in the file ST7565.cpp.
inline void ST7565::spiwrite(uint8_t c) {
shiftOut(sid, sclk, MSBFIRST, c);
Either change the pins off the SPI pins or change this to SPI.transfer;
inline void ST7565::spiwrite(uint8_t c) {
SPI.transfer(c);
You probably will need to include SPI.h in the same file, and call SPI.begin() in setup.
Thank you for the fast reply. Does this mean that the SPI Digital Pot(MCP3141) and the ST7565 LCD display must use the same Pins for MOSI ; SCLK and (MISO) ?
I am Using an Arduino Uno and Used the Pins As Follows:
// pin D4 - LCD :: Serial data out (SID)
// pin D5 - LCD :: Serial clock out (SCLK)
// pin D8 - LCD :: Data/Command select (RS or A0)
// pin D9 - LCD :: reset (RST)
// pin D10 - LCD :: chip select (CS)
// Pin D11(MOSI) - DIGITAL POT SDI
// Pin D13(SCK) - DIGITAL POT SCK
// PIN D18(A4) - DIGITAL POT CS