Writing data to the graphic display using serial interface instead of parallel

Thread Starter

RG23

Joined Dec 6, 2010
304
I used the following code while displaying the data to the graphic lcd

movlw 0x80//////cursor position
movwf PORTD
call SND_CMD

movlw 0x35///////data
movwf PORTD
call SND_DTA

The above statements allowed me to display the required pixels on graphic display but that was using the parallel interface to the LCD

But now I have to use serial interface and so I cannot send the entire byte to PORTD

I am not able to figure out how can I display the data as I did before

The command and data subroutines I used for the parallel interface are as follows:
/////PORTB,1--> Data or Command

/////PORTB,2--> RW

/////PORTB,4--> Enable


/////PORTB,5--> Reset
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; WRITE COMMANDS TO LCD
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SND_CMD:
bcf PORTB,1
bcf PORTB,2

bcf PORTB,5

bsf PORTB,4
nop
nop
nop
nop
bcf PORTB,4
bsf PORTB,5
return
;}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; WRITE DATA TO LCD
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SND_DTA:
;{
bsf PORTB,1
bcf PORTB,2

bcf PORTB,5

bsf PORTB,4
nop
nop
nop
nop
bcf PORTB,4
bsf PORTB,5
return

If anyone has an idea, please let me know

Thanks
 
Last edited:

absf

Joined Dec 29, 2010
1,968
You can "stream" or "bit bang" the data from port D to a shift register like 74HC595 which connects to the data lines of your GLCD. This scheme would used up 2 port pins from your PIC. Look at the example here.

http://embedded-lab.com/blog/?p=30

In the example, only RS and 4 data bits are shifted out. But in your case you can shift out all 8 bits ignoring RS as it was already taken care of by your PORT B,1.

Allen
 
Last edited:

Thread Starter

RG23

Joined Dec 6, 2010
304
The graphic display I am using has only one Serial data input pin.
I dont think shift register like 74HC595 can fix the problem
 

Thread Starter

RG23

Joined Dec 6, 2010
304
I could not find any example of serial interface to the graphic display

If anyone has an idea please let me know
Thanks
 

hexreader

Joined Apr 16, 2011
581
I think we will need some information on this mysterious graphic display that you are using, otherwise any advice would be just more guesswork.

Can you provide a link to the datasheet?

Sparkfun sell async serial input GLCDs which come with example code. Is this what you are using?

Which PIC are you using? (I assume this is PIC code, as it looks like it)
 
Last edited:

hexreader

Joined Apr 16, 2011
581
That GLCD uses SPI protocol.

It needs Clock, Data data/cmd and Select. 4 input wires (5 if you use reset), not one.

Looks very specialised to me. I have no experience of that display, or of that PIC.

I suspect that you may be out of luck and that you may be on your own, but who knows.

Sorry, but I cannot help.

... but at least we have some information now
 

Thread Starter

RG23

Joined Dec 6, 2010
304
I configured a similar Newhaven OLED display before but it supported parallel interface and could write entire byte to portD and display data successfully.

With this new display, there is only one serial data input line

I still couldn't figure what changes need to be done to the command and data subroutines I used for the parallel interface

or may be I am not approaching the issue correctly
 

ErnieM

Joined Apr 24, 2011
8,377
Your display uses a SPI interface, which is a standard way of moving serial data around a board, as opposed to say RS-232 which is expected to go between two remote device. There is lots of work on how to run these on the web.

How you approach this may depend on which PIC you are using. If your PIC has a "Master Synchronous Serial Port module" or such then it has hardware built in to handle the transfer for you. If it does not either buy another device that does or look into making a bit-banged SPI interface.
 

Thread Starter

RG23

Joined Dec 6, 2010
304
That is not my reading of the datasheet, but maybe I am wrong.

Still looks like SPI to me.
_____________________________________________________________

You are right
Just that
In the parallel interface interface, I could use D0 to D7 at the same time

Here I am limited to only one bit of PORTD
 

hexreader

Joined Apr 16, 2011
581
That is not my reading of the datasheet, but maybe I am wrong.

Still looks like SPI to me.
_____________________________________________________________

You are right
Just that
In the parallel interface interface, I could use D0 to D7 at the same time

Here I am limited to only one bit of PORTD
One bit of PORTD is not enough. You need at least two bits (clock and data) probably three, ideally 4.

... unless you want to add a second PIC into your design as an async serial to SPI driver?

... or change your LCD to an asynch serial one?
 

GetDeviceInfo

Joined Jun 7, 2009
2,196
I configured a similar Newhaven OLED display before but it supported parallel interface and could write entire byte to portD and display data successfully.

With this new display, there is only one serial data input line

I still couldn't figure what changes need to be done to the command and data subroutines I used for the parallel interface

or may be I am not approaching the issue correctly
yes, there is only one data line, but there's a clock and a chip select. Why wouldn't you send your data to the SPI instead.
 

Thread Starter

RG23

Joined Dec 6, 2010
304
Why wouldn't you send your data to the SPI instead.
______________________________________________________

I am trying by that method

but couldn't display the data

Is there any example or any link that can be helpful?
 

GetDeviceInfo

Joined Jun 7, 2009
2,196
Why wouldn't you send your data to the SPI instead.
______________________________________________________

I am trying by that method

but couldn't display the data

Is there any example or any link that can be helpful?
how are you controlling the data/command line?
 
Top