-
• #2
That is strange. It should work - I'll look into it next week.
-
• #3
That should work. I thought I'd done that in the past.
-
• #4
Maybe it should but in fact not.
Just connecting a Nokia5110 to the Pico.
SCK to pin B13
MOSI to B15
D/C to B10
RST to B1
SCE to B14 or A8
GND to GND
VCC to 3.3VThis code gives a blank screen
B14.write(1); //CS_LCD var g; var MONTHS = [ "Jan","Feb","Mar","Apr","May","Jun", "Jul","Aug","Sep","Oct","Nov","Dec" ]; function draw() { g.clear(); var t = new Date(); var date = t.getDate()+" "+MONTHS[t.getMonth()]+" "+t.getFullYear(); var time = t.getHours()+":" + ("0"+t.getMinutes()).substr(-2); var secs = ("0"+t.getSeconds()).substr(-2); // top left date g.setFontBitmap(); g.drawString(date,0,0); // middle time g.setFontVector(20); var timeWidth = g.stringWidth(time); g.drawString(time,(g.getWidth()-timeWidth-12)/2,10); // seconds over to the right g.setFontBitmap(); g.drawString(secs,(g.getWidth()+timeWidth-8)/2,26); // send to LCD g.flip(); } function onInit() { clearInterval(); // Setup SPI //var spi = new SPI(); SPI2.setup({ sck:B13, mosi:B15}); // Initialise the LCD // connect(/*=SPI*/_spi, /*=PIN*/_dc, /*=PIN*/_ce, /*=PIN*/_rst, callback) g = require("PCD8544").connect(SPI2,B10,B14,B1, function() { // When it's initialised, set up an animation at 1fps (1s per frame) setInterval(draw, 1000); }); } onInit();
and this one works as expected
A8.write(1); //CS_LCD var g; var MONTHS = [ "Jan","Feb","Mar","Apr","May","Jun", "Jul","Aug","Sep","Oct","Nov","Dec" ]; function draw() { g.clear(); var t = new Date(); var date = t.getDate()+" "+MONTHS[t.getMonth()]+" "+t.getFullYear(); var time = t.getHours()+":" + ("0"+t.getMinutes()).substr(-2); var secs = ("0"+t.getSeconds()).substr(-2); // top left date g.setFontBitmap(); g.drawString(date,0,0); // middle time g.setFontVector(20); var timeWidth = g.stringWidth(time); g.drawString(time,(g.getWidth()-timeWidth-12)/2,10); // seconds over to the right g.setFontBitmap(); g.drawString(secs,(g.getWidth()+timeWidth-8)/2,26); // send to LCD g.flip(); } function onInit() { clearInterval(); // Setup SPI //var spi = new SPI(); SPI2.setup({ sck:B13, mosi:B15}); // Initialise the LCD // connect(/*=SPI*/_spi, /*=PIN*/_dc, /*=PIN*/_ce, /*=PIN*/_rst, callback) g = require("PCD8544").connect(SPI2,B10,A8,B1, function() { // When it's initialised, set up an animation at 1fps (1s per frame) setInterval(draw, 1000); }); } onInit();
I have updated my Pico to 1V80
-
• #5
Thanks, I'll see what's up.
If you do need to use B14 then for now you can always use software SPI, which will definitely work fine. On something like the Nokia screen there's so little data that you won't notice any real slowdown.
-
• #6
Thanks to look at it.
Not really a problem. I have currently switched the SCE pin to another one. I was trying to use B14 in order to have more free pins for other purpose. -
• #7
I must apologize.
I have retried and found that the problem is coming from a stupid breadboard (and its stupid user).
It is a bit old and some contacts are "sporadic". Trashed and replaced by a new one and all is working as expected. -
• #8
Ok, great - thanks for letting me know!
Actually I just tried before I saw your post and it works fine here too ;)
Based on this, read in the reference:
I thought that I can connect the unused MISO line of an SPI to the CS of an LCD screen but it does not work.
to make my LCD work I had to change B14 to another pin.