Continue to Site

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

Well-Known 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: 246
  • 5110.png
    5110.png
    20.9 KB · Views: 247
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: 247
  • Lab9.pdf
    576.3 KB · Views: 240
Last edited:
hi C,
A quick checks, it looks OK to me.
E
 

Attachments

  • A02.gif
    A02.gif
    36.7 KB · Views: 261
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: 230
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: 258
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: 232
Last edited:
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: 246
  • SPI 061017.txt
    2.9 KB · Views: 235
Last edited:
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 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:
hi,
I have run your post #7 program, I get nothing like the scope image you have posted.??
E
 
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
 
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
 
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: 234
  • A03.gif
    A03.gif
    13 KB · Views: 237
  • A04.gif
    A04.gif
    14.5 KB · Views: 253
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.
 
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

Back
Top