View previous topic :: View next topic |
Author |
Message |
madhunica
Joined: 22 Dec 2013 Posts: 6
|
lcd display |
Posted: Sun Dec 22, 2013 10:47 pm |
|
|
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: 19520
|
|
Posted: Mon Dec 23, 2013 2:09 am |
|
|
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
|
thank you... |
Posted: Mon Dec 23, 2013 3:20 am |
|
|
Thanks for the commands... could you give me small example program for lcd display... thank you... |
|
|
madhunica
Joined: 22 Dec 2013 Posts: 6
|
|
Posted: Mon Dec 23, 2013 6:07 am |
|
|
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
|
|
Posted: Mon Dec 23, 2013 8:20 am |
|
|
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. |
|
|
|