• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Connecting 5110 LCD to PIC with SPI

camerart

Active Member
Thread starter #1
Hi,
When controlling SPI on a PIC an address is used, I follow this example from the Oshonsoft manual:
When connecting a 5110 module, which doesn't have addresses, how do I write an Oshonsoft program using one?
Camerart.
 

Attachments

ericgibbs

Well-Known Member
Most Helpful Member
#2
hi C,
I would not send the address line, just the 'data' as there is only the 5110 on the SPI Bus.

Found a couple of 5110 PDF's may be useful background info.
E

You could check this by using the Osh Scope feature.
spi.jpg
 

Attachments

Last edited:

ericgibbs

Well-Known Member
Most Helpful Member
#5
hi C,
Is the error msg that you get in Oshonsoft.?
The command is too complex for Osh to understand.

Have you read pages 6 thru 9 of the User PDF I posted.

E
 

Attachments

ericgibbs

Well-Known Member
Most Helpful Member
#6
hi C,
Try these options, note maximum of 5 args.!
I have not studied the 5110 but I would have thought you need to somehow address a register with the SPI befor loading the command/data.???

In the FUNCTION/PROC you should have
SPISend arg1
SPISend arg2 ''
etc.........

E
 

Attachments

Last edited:

camerart

Active Member
Thread starter #7
I have not studied the 5110 but I would have thought you need to somehow address a register with the SPI befor loading the command/data.???
Hi E,
I'm not sure, as I'm copying an existing program into Oshonsoft.

I tried various combinations and this works on the Oshonsoft Oscilloscope.
Thanks.
C.
 

Attachments

Last edited:

ericgibbs

Well-Known Member
Most Helpful Member
#8
hi C,
If you check your scope image it appears that every other block of clock pulses is carrying no data.??
The SPIPrepare should be part of the main code, not be within the Proc.
Try it.
E
 

camerart

Active Member
Thread starter #9
hi C,
If you check your scope image it appears that every other block of clock pulses is carrying no data.??
The SPIPrepare should be part of the main code, not be within the Proc.
Try it.
E
Hi E,
Done! Looks better.
Thanks.
C.
 
Last edited:

ericgibbs

Well-Known Member
Most Helpful Member
#10
hi,
I have run your post #7 program, I get nothing like the scope image you have posted.??
E
 

ericgibbs

Well-Known Member
Most Helpful Member
#14
hi.
I read the PIC type as 18F2550 not 18F2520... woops.!!!:(
I quick try shows a better reult
Will try again in detail after lunch.
E
 

ericgibbs

Well-Known Member
Most Helpful Member
#16
Hi C,
A quickie before lunch shows data for every CS when the SPIPrepare is moved from the PROC to earlier in the code as it should be.

I make mistakes often, I am a human.!

E
A02.gif
 

ericgibbs

Well-Known Member
Most Helpful Member
#17
hi C,
Checking your program it will not work as you expect, partly due to Osh.
Look at this alternative using Const, much tidier, also Osh is happy using names in Proc/Func
Run it twice, once as Write and another as Read
I have assumed an address method of 0x01, but as said, I have not studied the 5110

E
 

Attachments

#18
5110 uses oneway SPI , only spi clock and sdo are needed.
Spi address is not used.
Addionally from PIC: D/C , reset, chip select.
I am not sure, but probably chip select can be constantly on.
 

ericgibbs

Well-Known Member
Most Helpful Member
#19
hi C,
A quick scan thru of the 5110 d/s shows that the as far as the SPI is concerned, it is Write Only as jjw points out.

So for the SPI Write just follow this simple flow chart, ensure that Rst and D/C are correctly set first.
E
A05.gif
 

Latest threads

EE World Online Articles

Loading

 
Top