sivaramakrishna
Newbie level 5
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???
Thanks,
siva
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