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.

pic24f lcd error ??????????

Status
Not open for further replies.

sivaramakrishna

Newbie level 5
Joined
Oct 22, 2008
Messages
9
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,362
pic24f delay

Hai to all,

The code below for an lcd with pic24fj64ga002 and mplab c30 compiler gives me an error as

pic24lcd.c: In function 'cmd':
pic24lcd.c:28: error: syntax error before numeric constant
pic24lcd.c:32: error: syntax error before numeric constant
pic24lcd.c: In function 'data':
pic24lcd.c:41: error: syntax error before numeric constant
pic24lcd.c:45: error: syntax error before numeric constant
pic24lcd.c: At top level:
pic24lcd.c:50: warning: return type of 'main' is not 'int'
pic24lcd.c:94:2: warning: no newline at end of file


I could not understand where and why the syntax error occurs, can you please help me out.....
And also am I doing it in the right way???

Code:
#include <p24fj64ga002.h>
#define RS  PORTAbits.0
#define RwW  PORTAbits.1
#define EN  PORTAbits.2
unsigned char ar[]={"fabmax"},k=0;
unsigned long int i,j,a;
/*__________________________________________
//FUNCTION PROTOTYPE
//_____________________________________________*/

void delay(void);
void data(void);
 /*____________________________________________
// SEND DELAY
// ______________________________________________*/
// 
 void delay(void)
{

	for(i=0;i<=50;i++)
	for(j=1;j>0;j--);
}	
///*______________________________________________
//SEND DATA
//________________________________________________*/
void cmd(void)
{
	RS=k;
	RwW=0;
	EN=1;
	delay();
	EN=0;
	delay();

}	
///* ______________________________________________
//DATA SEND 
//_________________________________________________*/
void data(void)
{
	RS=1;
	RwW=0;
	EN=1;
	delay();
	EN=0;
	delay();
}

void main()
{
//________________________________________________
//port initialize section
//________________________________________________
		LATB = 0x0;
		LATA=0X0;
		TRISB = 0xff00;			// Configure LCD pins as output
		TRISA =0XFFF0;

	/*	TRISB=0X00;
		TRISC=0X00;
		PORTD=0X00;
		PORTC=0X00;
		PORTD=0X00;
		TRISD=0X00;*/
//_________________________________________________
// initialize section		
//_________________________________________________	

	PORTB=0x38;	//2lines 5X7 
	cmd();
	//delay();
	PORTB=0x0E;//display on cursor not blink
	cmd();
//	delay();	
	PORTB=0X0001;//clear display
	cmd();
//	delay();
	PORTB=0X0006;//increment shift cursor right 
//	delay();
	PORTB=0X0080;// cursor start 1st line 
	cmd();
//	delay();
	//cmd();
//__________________________________________________
for(a=0;a<6;a++)
{
	PORTB=ar[a];
	data();
	delay();

}
while(1);
}

Thanks,
siva
 

hi,
in place of

#define RS PORTAbits.0
#define RwW PORTAbits.1
#define EN PORTAbits.2


u write

#define rs _RA0
#define rw _RA1
#define e _RA2

i think it is working after that change
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top