Attached is the display I have in mind. I can talk to it with the 4 (or 8) bit parallel method but was looking at saving some pins if possible. It may turn out harder to do than I imagined.
What I like about this display is that it will work on 3.3 volts. Makes projects simpler without the need for 5 volts for a display.
There is a PASM and a Spin SPI engine in the library. Perhaps the Prop Tool should be modified to start with a splash screen that says "Look in the library"
Try this little code snippet which does not require an object. Since you are using a character display there is very little information that you need to send it and the timing is not critical, in fact the display needs time after each character to process the information, the maximum time being 600us for everything except the "clear display" command which requires up to 2ms. You can incorporate the test for this command in this function if you like.
You will not need to read data back from the display as this is only a busy flag and you may as well insert the necessary delay and save an I/O pin.
BTW, this is untested but should work as the interface is trivial.
con
scl = 0 ' clock
sdo = 1 ' data to display sdi
cs = 2 ' active low chip select
pub send(char,rs)
outa[scl]~~ ' ensure scl is high before we enable cs
dira[scl]~~
outa[cs]~ ' chip select low
dira[cs]~~
dira[sdo]~~ ' make sdo an output to connect to sdi of display
char ><= 10 ' reverse last 10 bits so we can send msb first by testing lsb
char |= rs ' add in rs into transmission (rs must be 0 or 1)
repeat 10
outa[scl]~ ' clock low before data setup (also leaves clock high at end)
outa[sdo] := char&1 ' setup next data bit
outa[scl]~~ ' clock the data
char >>= 1 ' next bit
outa[cs]~~ ' release chip select with clock still high
' <<<< insert a waitcnt for around 500us >>>>
waitcnt(40_000 +cnt) ' around 500us assuming an 80MHz clock
@Peter- Thanks for your code. I'll give it a try and let you know how it works.
@John- Yes I actually decided to look there shortly after I posted this question and found some examples. I never think to look but there are a lot of examples there. The OBEX search is so messed up.
Comments
What I like about this display is that it will work on 3.3 volts. Makes projects simpler without the need for 5 volts for a display.
John Abshier
You will not need to read data back from the display as this is only a busy flag and you may as well insert the necessary delay and save an I/O pin.
BTW, this is untested but should work as the interface is trivial.
@John- Yes I actually decided to look there shortly after I posted this question and found some examples. I never think to look but there are a lot of examples there. The OBEX search is so messed up.