CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

LCD display value no response??

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
haowhaow



Joined: 07 Feb 2011
Posts: 1
Location: MY

View user's profile Send private message AIM Address

LCD display value no response??
PostPosted: Mon Feb 07, 2011 10:09 pm     Reply with quote

I'm newbie in programming. I'm using pic18f4520 and 16 x 2 lcd.
After simulation is ok, but in real device, my lcd is blank.
I don't know how to configure my code. Can anyone here help me to solve it ?

Here is my code:
Code:

#include <18F4520.H>
#fuses HS,NOPROTECT,NOLVP,NOWDT
#device ADC=10         //10-bit conversion
#use delay(clock = 20000000)

#include "lcd.c"
   
void main()
{
   float temp, lsb;
   int8   msd, lsd;
   
   lsb = 5000.0/1024.0;               //lsb in mv
   
   lcd_init();                        //initialize lcd
   
   while(1)                        //do forever
   {
      setup_adc(ADC_CLOCK_INTERNAL);      //ADC clock source
      setup_adc_ports(ALL_ANALOG);      //ADC inputs
      set_adc_channel(0);               //select RA0

      delay_ms(100);
      temp = read_adc();               //get temperature

      /*convert reading to temperature*/
      temp = temp*lsb;            //temp in mv
      temp = temp/10.0;            //temp in degree C

      msd = temp;                  //msd digit
      lsd = 10.0*(temp-msd);         //lsd digit

      printf(lcd_putc,"\fTemp.: %U.%U C", msd,lsd);

      delay_ms(500);

   }   

}
tmsenthil03



Joined: 27 Feb 2011
Posts: 4
Location: chennai

View user's profile Send private message

PostPosted: Mon Feb 28, 2011 8:04 pm     Reply with quote

setup_adc(ADC_CLOCK_INTERNAL); //ADC clock source
setup_adc_ports(ALL_ANALOG); //ADC inputs


please mention above two lines are in the main loop not in the while loop...

And also check the LCD interface port what they have mention in the LCD.C header file

M.Senthilkumar
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group