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.

  • 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

Status
Not open for further replies.

camerart

Active Member
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

  • spi.jpg
    spi.jpg
    16.8 KB · Views: 95
  • 5110.png
    5110.png
    20.9 KB · Views: 103

ericgibbs

Well-Known Member
Most Helpful Member
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

  • User_Manual_ET_LCD5110.pdf
    684.4 KB · Views: 83
  • Lab9.pdf
    576.3 KB · Views: 76
Last edited:

ericgibbs

Well-Known Member
Most Helpful Member
hi C,
A quick checks, it looks OK to me.
E
 

Attachments

  • A02.gif
    A02.gif
    36.7 KB · Views: 100

camerart

Active Member
Hi E,
OK, that's good, thanks.
I'm trying to write a function, taken from a previous program, here it is not working in the attached program. I've got in a tangle.
C.
 

Attachments

  • 18lf2520 8MHz INT 5110 SPI 051017 0900.bas
    2.3 KB · Views: 66

ericgibbs

Well-Known Member
Most Helpful Member
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

  • A02.gif
    A02.gif
    14.7 KB · Views: 106

ericgibbs

Well-Known Member
Most Helpful Member
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

  • SPIa.bas
    2.5 KB · Views: 73
Last edited:

camerart

Active Member
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

  • SPI OSC.jpg
    SPI OSC.jpg
    50.9 KB · Views: 95
  • SPI 061017.txt
    2.9 KB · Views: 75
Last edited:

ericgibbs

Well-Known Member
Most Helpful Member
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
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
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
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
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
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

  • SPI 061017.bas
    2.2 KB · Views: 68
  • A03.gif
    A03.gif
    13 KB · Views: 90
  • A04.gif
    A04.gif
    14.5 KB · Views: 102

jjw

Member
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
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
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Top