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.

My First post here....looking for a little help(PIC)

Status
Not open for further replies.

Lithium381

New Member
I'm designing a project to interface with my car to extract certain information to analyze. I've created a PCB for the project, and have the majority of the code written, however, i'm having issues. On my development board, i have no trouble initializing the LCD screen that i've purchased.... using PIC16f877A.... my circuit uses PIC16F688.. On my circuit, the LCD will not initialize, using the same code from the 877. I was wondering if it's a software issue, or a hardware issue, and if i'm going about the whole thing wrongly.

**broken link removed**

that is the top down view of the LCD portion of my board (the power is on another layer).... ive assigned the following pins:
LCD <> PIC
D7 C5
D6 C4
D5 C3
D4 C2
D3 gnd
D2 gnd
D1 gnd
D0 gnd
E C1
Rw gnd
Rs C0

and set the following tags:
ADCON1 := 0; // no analog >< digital conversions
ANSEL := 0; // no analog inputs
ADCON0 := 0; // no analog >< digital conversions
CMCON0 := 7; // no comparators
TRISA := 2; // all but pin 2 is output
TRISC := 0; // all outputs on port C


help?
 
Is that Pascal? Also I read somewhere leave the 4 unused data pins on the LCD floating. Your layout seems to be missing many traces.
 
It looks like Pascal ... Not many pascal pic compilers around so I assume you use mikroPascal for PIC. If you are, pay attention that you change in your project settings the MCU type (it is 16F877A by default) to 16F688 and recompile the code.

Also, if you are using built in functions to access lcd do not forget to config the LCD library as by default D port is used, for you setup it should be something like:
Lcd_Config(&PORTC, 0, 1, 7, 5, 4, 3, 2);

If you do not execute Lcd_Config() the default port used is PORTD as that is where LCD is connected on easypic
 
Ahh A person also using ME's Pascal:)
arhi: Hit it on the nose most likely, damn that edit project screen! :)

I bet it was an easypic5 like mine, which would make it Lcd_Config(PORTB, 3, 2, 1, 0, PORTB, 4, 6, 5);

I have to agree, your missing some traces there. It's hard to say cause we know nothing about the other parts. Even using 4 bit mode, you would still have like 7 or so.
-BaC


Lithium381 said:
I'm designing a project to interface with my car to extract certain information to analyze. I've created a PCB for the project, and have the majority of the code written, however, i'm having issues. On my development board, i have no trouble initializing the LCD screen that i've purchased.... using PIC16f877A.... my circuit uses PIC16F688.. On my circuit, the LCD will not initialize, using the same code from the 877. I was wondering if it's a software issue, or a hardware issue, and if i'm going about the whole thing wrongly.

**broken link removed**

that is the top down view of the LCD portion of my board (the power is on another layer).... ive assigned the following pins:
LCD <> PIC
D7 C5
D6 C4
D5 C3
D4 C2
D3 gnd
D2 gnd
D1 gnd
D0 gnd
E C1
Rw gnd
Rs C0

and set the following tags:
ADCON1 := 0; // no analog >< digital conversions
ANSEL := 0; // no analog inputs
ADCON0 := 0; // no analog >< digital conversions
CMCON0 := 7; // no comparators
TRISA := 2; // all but pin 2 is output
TRISC := 0; // all outputs on port C


help?
 
Last edited:
@bacardi I actually use MikroC and not Pascal (and easypic4 as 5 is pretty new, what can I say, the mikroelektronika workshop is 10min drive from my house) but I presume they are pretty same on the "edit project" note ..

anyhow if he connected the pins as he wrote ..
LCD <> PIC
D7 C5
D6 C4
D5 C3
D4 C2
D3 gnd
D2 gnd
D1 gnd
D0 gnd
E C1
Rw gnd
Rs C0

then he should
Lcd_Config(PORTC, 0, 1, 7, 5, 4, 3, 2);

also, he should check the syntax as in mikroC there is
Code:
void Lcd_Custom_Config(char * data_port, char db3, char db2, char db1, char db0, char * ctrl_port, char rs, char ctrl_rw, char enable);
and
Code:
void Lcd_Config(unsigned short *port, unsigned short RS, unsigned short EN, unsigned short WR, unsigned short D7, unsigned short D6, unsigned short D5, unsigned short D4);

both used for 4bit LCD interface ...

there is lcd8... for 8bit interface but I do not see any reasons for using it :)
 
Begin
delay_ms(500);

ADCON1 := 0; // no analog >< digital conversions
ANSEL := 0; // no analog inputs
ADCON0 := 0; // no analog >< digital conversions
CMCON0 := 7; // no comparators
TRISA := 2; // all but pin 2 is output
TRISC := 0; // all outputs on port C

PORTA.2 := 1;
delay_ms(250); (* Flash LED to indicate *)
PORTA.2 := 0; (* functioning of PIC *)
delay_ms(250);

Lcd_Config(PORTC, 5, 4, 3, 2, PORTC, 0, 1, 1); (* Initalize LCD on portC*)

that's the only code i use regarding the LCD other than simple write commands. True, i do use the EasyPic5 and the Pascal complier for it... on the board, it's portB by default, and i can get that working with my PIC16f877.... on my 16f688, i don't have portB, so i used portC instead. In terms of missing traces, which ones? I would love for it to be that simple!!

the only traces not shown on my circuit board are the power/contrast, which i haven't included pin the picture, i know those work, the LCD turns on, but i can't get commands to it. I've got 4 data lines, the E, and the Rs going to the PIC, for a total of 6, i don't use the Rw, since i'll never read from it, i've just grounded that one, as well as the unused data pins.

and i have done EDIT project and changed those settings... i use an external clock @ 20mhz
 
You're missing all your power and gnd pins, no 0.1uf decoupling caps (you'll see the all over your EasyPIC PCB) The contrast pot isn't there. GND the RW line on the LCD... How are you powering it?
 
blueroomelectronics said:
You're missing all your power and gnd pins, no 0.1uf decoupling caps (you'll see the all over your EasyPIC PCB) The contrast pot isn't there. GND the RW line on the LCD... How are you powering it?


Really?.... No... Really?


Lithium381:
the only traces not shown on my circuit board are the power/contrast, which i haven't included pin the picture, i know those work, the LCD turns on, but i can't get commands to it. I've got 4 data lines, the E, and the Rs going to the PIC, for a total of 6, i don't use the Rw, since i'll never read from it, i've just grounded that one, as well as the unused data pins.

that is the top down view of the LCD portion of my board (the power is on another layer).... ive assigned the following pins:
LCD <> PIC
D7 C5
D6 C4
D5 C3
D4 C2
D3 gnd
D2 gnd
D1 gnd
D0 gnd
E C1
Rw gnd
Rs C0

I'm new here, and i don't want to sound mean, but did you even read the post? I've only shown traces/pins relevant directly to the LCD. The power is on another layer on the PCB, as i stated before.... it's properly powered and grounded.... the LCD turns on, but i cannot issue commands to it. You're right, there is no contrast pot, i grounded that one too. i get the blocks on the top row, and blank on the bottom. I'm having trouble communicating with it via the PIC. My issue is that it works with the 16f877 on the easypic, but not with my 16f688 on my pcb.
 
Lithium381 said:
You're right, there is no contrast pot, i grounded that one too.

That will not work :( .. If you ground the contrast line the LCD will be either too light (you will not see anything on it even if it is actually showing the txt) or you will only see black boxes instead of the txt. So you *have to* use the contrast pot to get the display to show the txt. Try it on the easypic, if you turn the embedded contrast pot to max or min you'll see that there is nothing on the lcd.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top