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 CCS Technical Support

lcd display

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



Joined: 22 Dec 2013
Posts: 6

View user's profile Send private message

lcd display
PostPosted: Sun Dec 22, 2013 10:47 pm     Reply with quote

I'm willing to display a text " analog input in lcd. but it shows the error in 31st line pls help me
Code:

#include <16F877.h>                           // Preprocessor directive that selects the chip
#fuses HS,NOWDT,NOPROTECT,NOLVP                // Preprocessor directive that defines the chip fuses
#use delay(clock=20000000)                     // Preprocessor directive that specifies clock speed
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7) // Preprocessor directive that includes RS232 libraries

#define ADC_CLOCK=3
#define ADC_SAMPLEUS=10
#define LCD_BITS=8
#define LCD_DREG=PORTB
#define LCD_DBIT=0
#define LCD_RSREG=PORTD
#define LCD_RSBIT=1
#define LCD_EREG=PORTD
#define LCD_EBIT=3
#define LCD_RWREG=PORTD
#define LCD_RWBIT=2
#define LCD_COMMANDUS=2000
#define LCD_DATAUS=50
#define LCD_INITMS=1
#define LCD_INIT1=PORTB
#define int8 an0 as word

void main(void)
{
int8 set_TRIS_B=0;
int8 set_input_an0=0x2c;
int8 set_ADCON1=0;

while(true)
  {
   int8 set_adcin=0;
   int8 set_an0;
   LCD_INIT1(PORT_B)
   LCD_cmdout(LCD_CLEAR)
   LCD_OUT(1,1,"ANALOG INPUT AN0")
   DELAY_ms(1);
  }
}
Ttelmah



Joined: 11 Mar 2010
Posts: 19552

View user's profile Send private message

PostPosted: Mon Dec 23, 2013 2:09 am     Reply with quote

Seriously, get a C textbook.....

The syntax is wrong in so many places that I'm surprised it gets as far as line 31...

Start with the #defines. You don't use '=' in these.

#define ADC_CLOCK 3

defines the text 'ADC_CLOCK' to be a text substitution for the number '3'. No '=' wanted/needed.

Then defines don't have types. Defines are _text macro substitutions_. So:

#define int8 an0 as word

makes no sense at all.

Then code lines need terminating semicolons. So the compiler will complain for the first time, when it gets to:

LCD_INIT1(PORT_B)

Since this is syntactically invalid immediately.

Same with the next two lines....
madhunica



Joined: 22 Dec 2013
Posts: 6

View user's profile Send private message

thank you...
PostPosted: Mon Dec 23, 2013 3:20 am     Reply with quote

Thanks for the commands... could you give me small example program for lcd display... thank you...
madhunica



Joined: 22 Dec 2013
Posts: 6

View user's profile Send private message

PostPosted: Mon Dec 23, 2013 6:07 am     Reply with quote

after correcting the error that you specified i get a same error sir that the "numerical expression is needed" in line 31 and undefined identifier in 32,33
oxo



Joined: 13 Nov 2012
Posts: 219
Location: France

View user's profile Send private message

PostPosted: Mon Dec 23, 2013 8:20 am     Reply with quote

There is no place to start helping you. Everything is wrong.

As Ttelmah says, read a C textbook. Learn how to program in C before you come here with problems.
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