Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

GLCD interfacing by pic16f876a source codes badly required !

Status
Not open for further replies.

Manonsilvermount

Newbie level 3
Joined
Nov 17, 2009
Messages
4
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
Norway
Activity points
1,317
Hi guys,

I'm new with GLCDs, but had good experience with 16x2 LCD. I'm using pic16f876a and have connected data bus of GLCD to PORTB, 0-7 and control bits of GLCD to PORTC, 0-5, GLCD contrast adjustment is also set properly.

can someone help me with Assembly code to interface with it.

thanks guys!

Fred
 

Re: GLCD interfacing by pic16f876a source codes badly requir

Hello!

I would need some more info to help you.
What kind of LCD? (I know, graphic, but I mean, what is the controller, what
is the interface (parallel? 3 wire spi? 4 wire spi?).
I know that the interface for character displays does not change a lot, but
for graphic displays, it's extremely variable, depending on the controller
maker.
For instance, we have a small color LCD here:
**broken link removed**
for which a driver has been written.
Now the specs have slightly changed. The driver changed from Sitronix to
UltraChip. The result is that the driver had to be completely rewritten, there
is not even one single line from the physical layer, that can be reused.
That was my work of today.

Dora

Added after 19 seconds:

Hello!

I would need some more info to help you.
What kind of LCD? (I know, graphic, but I mean, what is the controller, what
is the interface (parallel? 3 wire spi? 4 wire spi?).
I know that the interface for character displays does not change a lot, but
for graphic displays, it's extremely variable, depending on the controller
maker.
For instance, we have a small color LCD here:
**broken link removed**
for which a driver has been written.
Now the specs have slightly changed. The driver changed from Sitronix to
UltraChip. The result is that the driver had to be completely rewritten, there
is not even one single line from the physical layer, that can be reused.
That was my work of today.

Dora
 

Re: GLCD interfacing by pic16f876a source codes badly requir

Hi Dora!

thanks for your response.
it's a TS12864A-2 with NT7107 controller with 8bit parallel data bus. I got 2 datasheets (attached) for it with differernt instruction sets, which puzzled me.

your advise is very much appreciated.
Fred
 

Re: GLCD interfacing by pic16f876a source codes badly requir

doraemon said:
Hello!

I would need some more info to help you.
What kind of LCD? (I know, graphic, but I mean, what is the controller, what
is the interface (parallel? 3 wire spi? 4 wire spi?).
I know that the interface for character displays does not change a lot, but
for graphic displays, it's extremely variable, depending on the controller
maker.
For instance, we have a small color LCD here:
**broken link removed**
for which a driver has been written.
Now the specs have slightly changed. The driver changed from Sitronix to
UltraChip. The result is that the driver had to be completely rewritten, there
is not even one single line from the physical layer, that can be reused.
That was my work of today.

Dora

Added after 19 seconds:

Hello!

I would need some more info to help you.
What kind of LCD? (I know, graphic, but I mean, what is the controller, what
is the interface (parallel? 3 wire spi? 4 wire spi?).
I know that the interface for character displays does not change a lot, but
for graphic displays, it's extremely variable, depending on the controller
maker.
For instance, we have a small color LCD here:
**broken link removed**
for which a driver has been written.
Now the specs have slightly changed. The driver changed from Sitronix to
UltraChip. The result is that the driver had to be completely rewritten, there
is not even one single line from the physical layer, that can be reused.
That was my work of today.

Dora

Hi Dora!

thanks for your response.
it's a TS12864A-2 with NT7107 controller with 8bit parallel data bus. I got 2 datasheets (attached) for it with differernt instruction sets, which puzzled me.

your advise is very much appreciated.
Fred
 

Re: GLCD interfacing by pic16f876a source codes badly requir

Hi,

Looking at the two datasheets, be it quickly, the instructions seem the same, apart from where they have transposed the R/W columns.

The attatched file is in 18F assembler which should give you a good idea of how to use it on the 16F.
Also included is a simulator file to show it running.
 

Dear WP100,

that was all I needed, and your assistance was a bright light in the darkness.

many thanks !!
Fred
 
  • Like
Reactions: vishy71

    vishy71

    Points: 2
    Helpful Answer Positive Rating
Re: GLCD interfacing by pic16f876a source codes badly requir

hey friend i'm from Ecuador, i can't download this files, please are you can send a file ?
my e mail is rochisjc@hotmail.com thank you
 

Re: GLCD interfacing by pic16f876a source codes badly requir

Hi,

The files downloaded just now ok ...?

Have sent them to you via the PMs on this forum - you need a free program like WINRAR to unpack them.
 
  • Like
Reactions: vishy71

    vishy71

    Points: 2
    Helpful Answer Positive Rating
Re: GLCD interfacing by pic16f876a source codes badly requir

What version of proteus were you using? It doesn't work for me cause I have older version.

Added after 3 hours 33 minutes:

OkI got it to work with Proteus. All pin configuration info is in the asm file to make the schematic.

But my PIC programmer doesn't want to load the HEX file. It gives FUSE error, line 372: 0100010008F6

Any thoughts what's the problem?
 

Re: GLCD interfacing by pic16f876a source codes badly requir

Hi,

Which pic programmer are you using ?

The assembler is coded for the 18F4520 chip - are you using that or some other chip ?


This a .hex file I used on the demo, not sure if it was generated from that exact assembler / version , but very close - does it load into your programmer ?
 
  • Like
Reactions: vishy71

    vishy71

    Points: 2
    Helpful Answer Positive Rating
Re: GLCD interfacing by pic16f876a source codes badly requir

No it still gives similar error.
I'm using Micropro. I think it's the problem of Micropro and this family microcontrollers that doesn't fit. There is a little talk about this in kirsrus forum. I think there was a replacement program for this to use my programmer. I'll try to find it.

Actually I'm going to adopt this code to a different chip anyway so there should,t be a problem.

It's a really easy to read and beautifully written code. Thank you.
 

Re: GLCD interfacing by pic16f876a source codes badly requir

Hi,

Not familiar with that programmer - kitsrus do several versions ?

The code I have done will only program into a 18F4520 chip - are you trying to program it into a 16F chip ??

If you want to use it one a 16F chip there is a lot of backwards modifications needed to make it work.
 
  • Like
Reactions: vishy71

    vishy71

    Points: 2
    Helpful Answer Positive Rating
Re: GLCD interfacing by pic16f876a source codes badly requir

Kitsrus is old story. they don't make any programmers nowadays. The other program I was talking about was not developed by kitsrus, but by third party. I found it and it's called Warpdiy. This seems to load the hex well, but I have no chip to test it.
Yes I chose 4520.

I tried to compile this code into 16f887 HEX file. but it gave me a loooot of errors. I suppose it's not going to be easy.

Any thoughts, what are the main difficulties? 887 should be pretty similar to 4520?
 

Re: GLCD interfacing by pic16f876a source codes badly requir

Hi,

Well it shoulld be possible, but given that you are a beginner I think that might be a bit more than you can chew at the moment.

The main things to sort out are the Configs and oscillators, ram memory allocations and all the banking commands need to be added, plus other smaller things.

The other problem is that if you want to make real use of the glcd then you will want to store bitmap images and different fonts in the program memory - this is rather limited on the 16F range - the 18F4520 has a lot, the 46LF20 even more plus iit can run at 3v3 which is good for interfacing with the more modern spi 3v3 glcds.

It might be worth thinking about upgrading your kit to a Pickit2 programmer , would strongly suggest at genuine Microchip one although other clones or diy are around - that will cover all the chips you are likely to want to use for a very long time and also offers extra tools like debugger or logic analyzer etc.
 
  • Like
Reactions: vishy71

    vishy71

    Points: 2
    Helpful Answer Positive Rating
Re: GLCD interfacing by pic16f876a source codes badly requir

Juhuu I did it:D
I got it working, have to admit, only in proteus so far. I hope it works the same in real too.
I got it to initialize, fill and clear display also to display 8x6 and 16x12 fonts.
But still some questions raised
Q1:
How can I display fonts that are not 8, 16, 24, 32... dots high? You can write vertically 8 bits at a time. For example I want to display a character that is 10 pixels high so I first write upper 8 bits of the font, so there is more 2 rows of bits needed to complete the character. Then do I have to read lower 8 bits and add the 2 lower bits of the font to this value and then write?
I can't just write the lower 2 bits because some of them might be used by some another character below. right?

Q2:
There was a internet connection brake while I was writing my code so I had to figure it out my self. One of the things I couldn't figure out was how to read tables like this:
Code:
db	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ;32/ -->  
	db	0x00,0x00,0x4F,0x00,0x00,0x00,0x00,0x00 ;33/ --> !
	db	0x00,0x07,0x00,0x07,0x00,0x00,0x00,0x00 ;34/ --> "
	db	0x00,0x14,0x7F,0x14,0x7F,0x14,0x00,0x00 ;35/ --> #
	db	0x00,0x24,0x2A,0x7F,0x2A,0x12,0x00,0x00 ;36/ --> $
                                   .....

Is it possible to use it with 16F chip? I used this instead:
Code:
			retlw	0x00
			retlw	0x06
			retlw	0x09
			retlw	0x06
			retlw	0x00
			......
 

Re: GLCD interfacing by pic16f876a source codes badly requir

Hi,

Thats good to know that you got it working ok.

As to displaying different height fonts well yes you can display any size, but its up to you to control it as you can see.

That demo code was to show that it can be done in assembler and was kept as simple as possible, if you want to do other stuff then you really need to understand how all the code works together, then you can modify things as you want them.

Yes, the 16F chips can drive the glcds, but it will take a lot of work to convert that code, plus you will soon start having a lot of Paging problems because the glcd routine with all its fonts and bitmaps use a lot of memory - the main reason the 18F chips were used.

The 16Fs also supports the db directives, see MPlab help, Mpasm section for details.
 
  • Like
Reactions: vishy71

    vishy71

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top