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.

LCD display with pic16f877a

Status
Not open for further replies.

john120

Banned
Joined
Aug 13, 2011
Messages
257
Helped
11
Reputation
22
Reaction score
10
Trophy points
1,298
Activity points
0
Hello every body,I am trying otinterface my lcd to pic16f877a but as this is the first time I am not coming to the right solution.
could you please help me to solve the issue.

I am using CCS C COMPILER OR MPLAB with assembly language.

Thanks
 

I am using 16*1 Lcd display with pic16f877a ,I want to display "hello" in full screen.
The codes in assembly and ccs c are welcome.

My simulation in Proteus has been added here.
 

I am using 16*1 Lcd display with pic16f877a ,I want to display "hello" in full screen.
The codes in assembly and ccs c are welcome.

My simulation in Proteus has been added here.

Hi,

This should get you going, plenty of tutorials on lcds if you search this forum.
 

Attachments

  • LCD877A.7z
    74.3 KB · Views: 59

I want to display " Hello" alone and then display " World"after the first cleared and so on meanwhile displaying a world at a time and in using only one line not 2 lines mode.

Thanks!!
 

I want to display " Hello" alone and then display " World"after the first cleared and so on meanwhile displaying a world at a time and in using only one line not 2 lines mode.

Hi,

The code is a complete simple demo of displaying to the most common 16 x 2 display -sure you can work out how to use it with just one line...
 

hi if you have not find solution i can help you. tell me!!!
 

#include <16f877.h>
#fuses xt, nowdt, noprotect, noput
#use delay (clock = 4000000)
#include "lcd.c“ // include this lcd driver
void main()
{
lcd_init(); // initialize the lcd module
lcd_putc(“HELLO WORLD \n"); // prints HELLO WORLD in 1st line and returns the cursor to 2nd line lcd_putc(“world "); // prints world in 2nd line
}
 

Yes,thanks for your reply,how can I display the resukt of an ADC reading after displaying those lines??
for example after displaying "World" use a button then the pic reads the adc and display its result on the screen.

Thanks!!
 

you need to use ADC of the pic and you must create a functions to do that....
 

Hi,

The code shows how to convert your adc result using an Ascii converter subroutine.

However the ascii converter I have only converts a 8 bits / one byte value into a 3 ascii digits.

For a full 10bit adc result you will need to search for an ascii converter than will accept 10/16 bits and produce at least 4 digits of ascii output or display the adc result as a series of ten x ones and zeros
 

Attachments

  • 2013-02-11 12_43_54-877Alcd - ISIS Professional (Animating).jpg
    2013-02-11 12_43_54-877Alcd - ISIS Professional (Animating).jpg
    96.3 KB · Views: 80
  • 877lcd.7z
    3 KB · Views: 40

hi friend,
how to write adc program with out using library function
 

can somebody help me with the codes for getting adc on the lcd using ccs c compiler?

Thanks!!
 

You have to save the adc result in an int variable and then convert the int or float value to string and display it on lcd.[/QUOTENormally,I know how to do ADC and display for example on seven segment but now I want to display on LCD see the code below for example on seven segment display it on LCD:
#include<16f877a.h>
#device ADC = 10 // Need to tell compiler ADC is configured for 10-bit reading
#fuses HS,NOWDT
#use delay(clock=20000000)
#include<stdio.h>
#include<STDLIB.H>
#use standard_io(A)
#use standard_io(B)
#use standard_io(D)
#define PORTB
#DEFINE PORTC
#define PORTA


byte const digit[]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90};

char display[2];
int value;
unsigned long volt;
unsigned int value2;

void main(){
set_tris_A(0xFF);
set_tris_B(0X00);
set_tris_D(0x00);
output_b(0);
output_d(0);

setup_comparator(NC_NC_NC_NC);
setup_adc(ADC_CLOCK_INTERNAL);
setup_adc_ports(AN0);
set_adc_channel(0);
setup_vref(FALSE);

while(TRUE){
delay_us(100);
//value=read_adc(); //Not required
read_adc(ADC_START_ONLY);
delay_us(100);
value=read_adc(ADC_READ_ONLY);

volt=(value*500)/1023; //I changed this part of the code
value2=volt;

output_low(PIN_D1);
display[0]=value2/10;
output_high(PIN_D0);

output_B(digit[display[0]]);
delay_ms(10);
output_low(PIN_D0);
display[1]=value2%10;
output_high(PIN_D1);

output_B(digit[display[1]]);
delay_ms(10);

}
}

Thanks
 

#include <16f877a.h>
#device ADC=10
#use delay(clock=4000000)
#Fuses HS,NOWDT,NOPROTECT,PUT,NOLVP
#use rs 232(baud=4800,xmit=PIN_C6)
#bit LED=5.5

#include <lcd.c>

void main()
{

float temperature;
float temp;
float value;
float volt;
setup_adc_ports( ALL_ANALOG );
setup_adc(ADC_CLOCK_INTERNAL );
set_adc_channel( 0 );

value = read_adc();
volt = (value / 1023) * 5;
temp = volt * 100;


lcd_init();
set_tris_a(0x1F);
//set_tris_d(0b11110111);
set_tris_b(0xff);
set_tris_c(0xff);
delay_ms(5);
lcd_gotoxy(1,1);
printf(lcd_putc "\fHow");
delay_ms(1500);
printf(lcd_putc "\fis it ");
delay_ms(1500);
printf(lcd_putc "\ffor ");
delay_ms(1500);
printf(lcd_putc "\fyou");
delay_ms(1500);
printf(lcd_putc "\fall?");
delay_ms(5000);
//printf(lcd_putc "temperature:%3.2f\f",temp);

printf(lcd_putc,"Temp is:%f",temp);

}
see the exercice I am doing but the last line is not printing the temperature on the lcd,what is the syntax for that?

Help me plz!!
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top