Help, error syntax i dont know

Discussion in 'Programmer's Corner' started by LAAT, May 14, 2015.

  1. LAAT

    Thread Starter New Member

    May 14, 2015
    10
    2
    Code (Text):
    1.  
    2. [program.c]#include <p18cxxx.h>
    3. #include <delays.h>
    4. #pragma config PLLDIV = 5 // (20 MHz crystal)
    5. #pragma config CPUDIV = OSC1_PLL2
    6. #pragma config USBDIV = 2 // Clock source from 96MHz PLL/2
    7. #pragma config FOSC = HSPLL_HS
    8. #pragma config WDT = OFF
    9. #pragma config LVP = OFF
    10. #include "lcd.h"
    11.  
    12. CHAR buffer1[16]="HELLO WORLD";
    13. CHAR buffer2[16]="Hola Mundo";
    14.  
    15. void main() {
    16.  
    17. ADCON1 |= 0x0F; //A/D port as digital
    18. PORTC = TRISC = 0x00;
    19. PORTB = TRISB = 0x00;
    20.  
    21. //lcd_init();
    22. //lcd_clear();
    23. //lcd_display(1,1,buffer1);
    24. //lcd_display(2,3,buffer2);
    25. for( ;; );
    26. }[/program.c]
    27.  
    Code (Text):
    1.  
    2. [lcd.h]typedef void VOID;
    3. typedef int INT;
    4. typedef signed char INT8;
    5. typedef signed int INT16;
    6. typedef signed long INT32;
    7. typedef unsigned short WORD;
    8. typedef char CHAR;
    9. typedef unsigned char BYTE;
    10. typedef double FLOAT;
    11. typedef long LONG;
    12. typedef INT8 BOOL;
    13. //Display Config.
    14. #define MAX_DISPLAY_CHAR 16
    15. //LCD Registers addresses (PORT E)
    16. #define LCD_CMD_WR 0x00
    17. #define LCD_DATA_WR 0x01
    18. #define LCD_BUSY_RD 0x02
    19. #define LCD_DATA_RD 0x03
    20. //LCD Commands
    21. #define LCD_CLS 0x01
    22. #define LCD_HOME 0x02
    23. #define LCD_SETMODE 0x04
    24. #define LCD_SETVISIBLE 0x08
    25. #define LCD_SHIFT 0x10
    26. #define LCD_SETFUNCTION 0x20
    27. #define LCD_SETCGADDR 0x40
    28. #define LCD_SETDDADDR 0x80
    29. #define E_PIN_MASK 0x04
    30. #define FALSE 0
    31. #define TRUE 1
    32. /************************************************************************
    33. ***** FUNCTION PROTOTYPES *****
    34. ******************************/
    35. VOID lcd_display (CHAR y, CHAR x, CHAR *buf);
    36. VOID lcd_char (CHAR ch);
    37. VOID lcd_init(void);
    38. VOID lcd_wait(void);
    39. VOID wrcmd (CHAR data);
    40. VOID wrdata(CHAR data);
    41. VOID lcd_clear(void);
    42. VOID lcd_reset(void);
    43. VOID Setpos(CHAR y, CHAR x);[/lcd.h]
    44.  
    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: May 15, 2015
  2. LAAT

    Thread Starter New Member

    May 14, 2015
    10
    2
    Help me please
     
  3. pwdixon

    Member

    Oct 11, 2012
    488
    56
    Can you put this into context? What compiler/library is this?
     
  4. LAAT

    Thread Starter New Member

    May 14, 2015
    10
    2
    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
     
  5. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    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.
     
    flat5 and LAAT like this.
  6. LAAT

    Thread Starter New Member

    May 14, 2015
    10
    2
    thanks very grateful, I worked
     
    ErnieM likes this.
  7. DerStrom8

    Well-Known Member

    Feb 20, 2011
    2,428
    1,328
    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?
     
  8. LAAT

    Thread Starter New Member

    May 14, 2015
    10
    2
    already solved, thanks
     
    DerStrom8 likes this.
  9. LAAT

    Thread Starter New Member

    May 14, 2015
    10
    2
    thanks very grateful, I worked
     
Loading...