SPIOUT vs HSPIOUT

Aries

New Member
I'm baffled. I'm trying to use a Nokia 5110 with a 20x2 - many thanks to the posts on the forum which enabled me to see in general how to do it.
I started with bit-banging - no problem - then moved to spiout for speed - again, no problem.
However, I can't get hspiout to work. Obviously I'm missing something, but I cannot see what. When the code executes, the pixels turn black at point B (as if "all pixels on") and the screen goes completely black at point F (as if "inverse video mode"). My first thought was that hspiout is supplying the bits LSB rather than MSB (although I don't think it does) because the two commands (VOP at point B and contrast at point F) when reversed are exactly the bit patterns for the two as-ifs. However reversing the bits doesn't make it work. Any ideas??
 

Attachments

hippy

Ex-Staff (retired)
Welcome to the PICAXE Forum.

Your approach is a good mechanism; have the program choose either SPIOUT or HSPIOUT, so if one works the other should, and if it doesn't it's almost certainly related to that choice rather than anything else in the program.

After only really a glance at the program there was nothing obvious which leapt out, though it might be better if the HSPISETUP were moved to just after the "Starting" and before the rest of the VDD/RST initialisation. Perhaps not, as it only seems to encounter problems later.

The only other immediate thought is that HSPI is faster so it could be a timing issue. Perhaps add PAUSE 100 before the RETURN in your SendCommand / SendData routine, at least temporarily.
 

srnet

Senior Member
I produced some code for the 5110 on a 20X2, although the core code came from Hippy if my memory is behaving.

I tried to follow your code, but got lost, there appears to be multiple entry points into subroutines which confused me.
 

Aries

New Member
Thank you hippy and srnet for your comments.

Hippy - I've tried moving the HSPISETUP and adding a pause as you suggested - no change.

srnet - particular thanks to you - I based my code on yours, including the multiple entry-points for the SendCommand/SendData subroutines. I added the other "SendXXXCommand" entry points to keep the code size down. As a Fortran programmer from more years ago than I care to remember, I am used to subroutines with multiple entry points and single returns.

In a way I'm glad than nothing immediately jumps out, but I had hoped to get an improvement in refresh rate on the 5110 by moving from spiout to hspiout.
 

lbenson

Senior Member
Aries,

Could you post your bit-banging code for the 5110? I made a brief stab at it with a 14M2, but it didn't work right off and I moved to other projects. I glanced at it again yesterday, and if you can show me how you got it to work, I'll try it again.
 

srnet

Senior Member
Thank you hippy and srnet for your comments.

Hippy - I've tried moving the HSPISETUP and adding a pause as you suggested - no change.

srnet - particular thanks to you - I based my code on yours, including the multiple entry-points for the SendCommand/SendData subroutines. I added the other "SendXXXCommand" entry points to keep the code size down. As a Fortran programmer from more years ago than I care to remember, I am used to subroutines with multiple entry points and single returns.

In a way I'm glad than nothing immediately jumps out, but I had hoped to get an improvement in refresh rate on the 5110 by moving from spiout to hspiout.
I thought the code here;

http://www.picaxeforum.co.uk/showthread.php?21676-Mini-Morse-decoder-using-Nokia-5110-graphics-LCD&highlight=5110

Already did use hspiout ?
 

Aries

New Member
Yes it does. At the time I was working with a 20m2, so I took the concepts (initialisation, SendCommand etc) and re-did them with bitbanging for the 20m2. Now that I need the code for a 20x2 (and there is much more code than in the test example I uploaded), I tried to go back to the spiout and hspiout methods. spiout works, hspiout appears not to.
 

Aries

New Member
SOLVED!!!

srnet - you are quite right (of course). Your code does use hspiout and (although I have not actually used it) I'm sure it works. It uses

HSpiSetup SPIMODE11e, SPISLOW.

When I tried to change back to hspi, I took the code from hippy's post http://www.picaxeforum.co.uk/showthread.php?18500-Graphical-LCD-module-from-mobile Lcd_006.txt has

HSpiSetup SPIMODE01, SPISLOW

and I didn't spot the difference. Your mode setting works.

Thanks to everyone for their help.
 
Top