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.

Hey Nigel, help with your PIC LCD tutorial

Status
Not open for further replies.

NewGeek

New Member
I copied the entire code on your LCD tutorial just to see if I could get my LCD working.
I am using a 16F84A, so I changed the processor name at the top, as well as the include file.
I also omitted the two lines that turn the 16F628 comparators off.
When I turn it on, the cursor flashes, jumps forward two characters, then jumps 3 characters forward and thats it! No characters, just a cursor.

Have you got any suggestions about what I might try?

Also, do you have a schematic for the LCD-PIC pin assignments? I couldnt find it on your site.

By the way, thank you much for the tutorials and the software. It is very helpful for beginners like me.
 
NewGeek said:
I copied the entire code on your LCD tutorial just to see if I could get my LCD working.
I am using a 16F84A, so I changed the processor name at the top, as well as the include file.
I also omitted the two lines that turn the 16F628 comparators off.
When I turn it on, the cursor flashes, jumps forward two characters, then jumps 3 characters forward and thats it! No characters, just a cursor.

Have you got any suggestions about what I might try?

It should work OK on a 16F84, as long as you use PortB - although I would check the start address for the general purpose registers, I'm not sure the start address is the same (it's been a long time since I used one).

Also, do you have a schematic for the LCD-PIC pin assignments? I couldnt find it on your site.

There are basically two different connections for LCD's, either single inline or dual inline, both should have numbers printed on the boards (or at least pin 1), the numbers correspond to those on the LCD hardware page.
 
Yes, that was the one other thing I changed:

Your code:

LCD_PORT Equ PORTA
LCD_TRIS Equ TRISA

I changed to:

LCD_PORT Equ PORTB
LCD_TRIS Equ TRISB

Is that all I need to do?

Sorry, I somehow missed the hardware page link. I will check the addressed. Thanks for your help
 
Yes, that was the one other thing I changed:

Your code:

LCD_PORT Equ PORTA
LCD_TRIS Equ TRISA

I changed to:

LCD_PORT Equ PORTB
LCD_TRIS Equ TRISB

Is that all I need to do?

Sorry, I somehow missed the hardware page link. I will check the addressed. Thanks for your help
 
A question about the start address: does the start address in the code have to be the FIRST address in the GPR or can it be any address in the GPR?
i.e. can you store values anywhere in the GPR or do they have to be sequential, starting at the first available?

for the PIC16F84 the GPR starts at 0x0C but could I code my first variable like this:

MyVar equ 0x0E

does it matter where I start? I know logically it makes sense to start the first address, but just curious
 
Actually I ended up using Nigel's code. Its working now and Im playing around with it making changes.
The code from Falleafd worked (text was displayed), but there were a bunch of interrupt routines that were causing some weird and unpredictable multi-layered loops. Without the schematic for his interrupt switches, it made Nigels code look much easier.

So FYI Nigel, your code works fine on a PIC16f84A, the only changes are:

Change the LCD_PORT to PORTB
Change LCD_TRIS to TRISB
Remove command to turn off comparators
Wire it up using your schematic, but substitute RB0 through RB7 for RA0 through RA7.
Pretty simple actually, I had a misplaced wire on my breadboard.

You probably already know this but I wanted to post for other newbies. Thanks again Nigel and Falleafd!
 
NewGeek said:
A question about the start address: does the start address in the code have to be the FIRST address in the GPR or can it be any address in the GPR?
i.e. can you store values anywhere in the GPR or do they have to be sequential, starting at the first available?

for the PIC16F84 the GPR starts at 0x0C but could I code my first variable like this:

MyVar equ 0x0E

does it matter where I start? I know logically it makes sense to start the first address, but just curious

You can start where you like, but (as you say) it makes sense to start at the first address - basically because it's giving you the largest number of registers then.
 
NewGeek said:
Actually I ended up using Nigel's code. Its working now and Im playing around with it making changes.
The code from Falleafd worked (text was displayed), but there were a bunch of interrupt routines that were causing some weird and unpredictable multi-layered loops. Without the schematic for his interrupt switches, it made Nigels code look much easier.

Yes, ofcourse, because he's newbie like you, so he's just copy and paste nigel's code, then he modified some places, but he didn't know why. So some weird still stay still :))

Anyways, it's good that you did your LCD.

Thanks for noting it for meeh.
 
Oh sorry Nigel,

my student did come to this site and see his code, because I tell him that something went wrong with his code. He said that I posted the wrong code :). I'd showed him the errors when writing interrupt on change, however, he didn't resend me his new code yet...

sorry for my carelessness.
 
Status
Not open for further replies.

Latest threads

Back
Top