Interface LCD with PIC18f452

Thread Starter

Afnan_123_

Joined Feb 7, 2013
22
Hello
I am working in project to measure the temperature of the room
when i did it in proteus program it's working,
but can anyone check the connection of the pins ?
because i think we should use capacitor and resistor?
if we should use it, where i can connect them in the circuit?
Rich (BB code):
// Lcd pinout settings
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D7 at RB3_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D4 at RB0_bit;

// Pin direction
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D7_Direction at TRISB3_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB0_bit;

int x=0;
float temp=0;
char txt[12];
void main() {
lcd_init (); ADC_init ();   //analogue and digital converter
lcd_cmd(_lcd_cursor_off);
trisa.b0=1;
porta.b0=0;
trisd.b1=0;
portd.b1=0;
while (1) {
x=ADC_read (0);  // 0 refers to the port number
temp=x*0.489;
floattostr (temp,txt);
lcd_out (1,1,txt);
if (temp<24) { portd.b0=0; }
else { portd.b1=1;}
} }
 

Thread Starter

Afnan_123_

Joined Feb 7, 2013
22
just i did the connection in proteous and the code , i didn't do anything else

but my confuse is no capacitor and resistor is connected
should i use it in hardware?
 

tshuck

Joined Oct 18, 2012
3,534
but u r said The PIC18f452 doesn't have an internal oscillator.
and pins 13 and 14 is OSC1 and OSC2
Yes, yes I did. Again, read pages 19-21 of the datasheet. These pins are for connecting oscillators...


If your circuit works in a simulation, why are you trying to add more parts?:confused:
 

ErnieM

Joined Apr 24, 2011
8,377
What we've got here is failure to communicate.

Afnan 123: That's what I want to find out. I want you to tell me the names of the fellows on the St. Louis team.

tshuck: I'm telling you. Who's on first, What's on second, I Don't Know is on third--

Afnan 123: You know the fellows' names?

tshuck: Yes.

Afnan 123: Well, then who's playing first?

tshuck: Yes.

Afnan 123: I mean the fellow's name on first base.

tshuck: Who.

Afnan 123: The fellow playin' first base.

tshuck: Who.

Afnan 123: The guy on first base.

tshuck: Who is on first.

Afnan 123: Well, what are you askin' me for?

tshuck: I'm not asking you--I'm telling you. Who is on first.

Afnan 123: I'm asking you--who's on first?

tshuck: That's the man's name.

Afnan 123: That's who's name?

tshuck: Yes.
Afnan, the pins you use seem fine. You will need something external to the PIC to get it to oscillate as it has no internal oscillator: an RC is fine for many things. Do read the data sheet where tshuck mentioned to understand this critical item.

Do make a schematic first, then follow it to build the hardware.

Plan you work, then work your plan.
 

thatoneguy

Joined Feb 19, 2009
6,359
How do you know what will be connected where to write the code??

You need a schematic first, you probably drew one in Proteus to verify whatever you are doing is doing what you want it to, right?

Print that schematic, take a screen shot of it and post it as an attachment.

The OSC pins are for connecting the external oscillator components (RC or crystal), not for providing an oscillator to another microcontroller.
 
Top