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.

[PIC] Problem to display lcd [urgent]

Status
Not open for further replies.

harisali

Newbie level 1
Joined
Apr 22, 2015
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
12
hi there ..
i have a problem to display a lcd using 16f877a
im new in here .. please help me
i attach along with my circuit and coding
Capture.JPGCapture2.JPG
PHP:
#include <16F877A.h>
#device adc=8
#fuses HS,NOWDT, NOPROTECT, PUT
#use delay(clock = 20 000 000)
#include <lcd.c>


void main (void)
{
   float photo;
   setup_adc(ADC_CLOCK_INTERNAL);
   setup_adc_ports(ALL_ANALOG);
   lcd_init();
   
   while (1)
   {
      lcd_putc ("\f");
      set_adc_channel(0);
      delay_us(20);
      photo = read_adc();
      photo = (photo*.0197)/5*100;
      lcd_putc("LIGHT METER");
      Printf (lcd_putc);
      
      
      
      lcd_putc("\n");
      lcd_putc("Light= ");
      printf (lcd_putc, "%2.2f", photo);
      delay_ms(100);
      
      


   }
   }
 

Post lcd.c file. We have to see if your LCD pin connections are defined properly in that file.
 

Without knowing anything else, some of your code looks "suspicious".
Going by the name and the way it is used "lcd_putc" would appear to be a function that would send a character to the LCD. However in most cases you are passing it a string which, in C, would be passed as a pointer to an array.
Therefore, if the function is expecting a character and is being passed a pointer, then it will output "random" values to the LCD.
Further, the "printf" function has the function name passed as the first parameter. The 'standard' printf function requires that the first parameter is the format string (which you have as the 2nd parameter). I am not aware of any variant in the 'printf' family of functions that takes a function pointer as the first parameter (presumably to use that to output the characters generated by the function). That may be my ignorance but in this case I suspect it is your misunderstanding on what the function does.
Susan
 

No, the code si correct. It is CCS C Code. We have to see lcd.c to give a solution.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top