Help, error syntax i dont know

Thread Starter

LAAT

Joined May 14, 2015
10
Code:
[program.c]#include <p18cxxx.h>
#include <delays.h>
#pragma config PLLDIV = 5 // (20 MHz crystal)
#pragma config CPUDIV = OSC1_PLL2
#pragma config USBDIV = 2 // Clock source from 96MHz PLL/2
#pragma config FOSC = HSPLL_HS
#pragma config WDT = OFF
#pragma config LVP = OFF
#include "lcd.h"

CHAR buffer1[16]="HELLO WORLD";
CHAR buffer2[16]="Hola Mundo";

void main() {

ADCON1 |= 0x0F; //A/D port as digital
PORTC = TRISC = 0x00;
PORTB = TRISB = 0x00;

//lcd_init();
//lcd_clear();
//lcd_display(1,1,buffer1);
//lcd_display(2,3,buffer2);
for( ;; );
}[/program.c]
Code:
[lcd.h]typedef void VOID;
typedef int INT;
typedef signed char INT8;
typedef signed int INT16;
typedef signed long INT32;
typedef unsigned short WORD;
typedef char CHAR;
typedef unsigned char BYTE;
typedef double FLOAT;
typedef long LONG;
typedef INT8 BOOL;
//Display Config.
#define MAX_DISPLAY_CHAR 16
//LCD Registers addresses (PORT E)
#define LCD_CMD_WR 0x00
#define LCD_DATA_WR 0x01
#define LCD_BUSY_RD 0x02
#define LCD_DATA_RD 0x03
//LCD Commands
#define LCD_CLS 0x01
#define LCD_HOME 0x02
#define LCD_SETMODE 0x04
#define LCD_SETVISIBLE 0x08
#define LCD_SHIFT 0x10
#define LCD_SETFUNCTION 0x20
#define LCD_SETCGADDR 0x40
#define LCD_SETDDADDR 0x80
#define E_PIN_MASK 0x04
#define FALSE 0
#define TRUE 1
/************************************************************************
***** FUNCTION PROTOTYPES *****
******************************/
VOID lcd_display (CHAR y, CHAR x, CHAR *buf);
VOID lcd_char (CHAR ch);
VOID lcd_init(void);
VOID lcd_wait(void);
VOID wrcmd (CHAR data);
VOID wrdata(CHAR data);
VOID lcd_clear(void);
VOID lcd_reset(void);
VOID Setpos(CHAR y, CHAR x);[/lcd.h]
MapLab IDE to compile with the extension C18 shows me that
\lcd.h:42:Error: syntax error . and this is the line: VOID Setpos(CHAR y, CHAR x);

Moderators note : Please use code tags for pieces of code
 
Last edited by a moderator:

Thread Starter

LAAT

Joined May 14, 2015
10
sorry is not my native language and I'm starting in the world of microcontrollers. the compiler is an extension of MAPLAB IDE is MAPLAB C18 lite 1.jpg

is to turn a LCD lm016 with a pic 18F4550, the error is in the prototype function, I add that the library is lcd.h
 

ErnieM

Joined Apr 24, 2011
8,415
This is going to sound very strange but I believe it is your problem:

Go to the very end of line 42 in lcd.h and press the enter key. Then save and compile it again.

There is a quirk in the C18 compiler where it needs to see a return after the very last line or it raises an error on good code.
 

DerStrom8

Joined Feb 20, 2011
2,390
Does MPLAB tell you any more about the error? Could you post an image of the compile screen?

Where's the rest of the code?
 

Thread Starter

LAAT

Joined May 14, 2015
10
This is going to sound very strange but I believe it is your problem:

Go to the very end of line 42 in lcd.h and press the enter key. Then save and compile it again.

There is a quirk in the C18 compiler where it needs to see a return after the very last line or it raises an error on good code.
thanks very grateful, I worked
 
Top