Im having problems initialisation an LCD with the AT89C51 uC. The LCD im using is HD44780u.
The errors im getting are compilation errors, C141: syntax error near ')' and C141: syntax error near 'data'. These are near the writeChar_LCD method.
However i dont see what the error is, any help would be appreciated. Thanks
Code:/*** Include Files *******************************************************/ #include <t89c51ac3.h> #include "..\lib\phys340libkeil.h" #include <string.h> #define RS P4_0 // Register Select signal #define EN P4_2 // Enable signal #define RW P4_1 // R/W signal #define LCD_DATA P0 // Data line /*** Functions ****************************************************/ void LCD_cmd(unsigned char cmd); void init_LCD(void); void writeChar_LCD(unsigned char data); /*** Main Function ************************************************/ void main() { init_LCD(); //initialise display while(1) { writeChar_LCD('h'); } } /*** Send Command to lcd ******************************************/ void LCD_cmd(unsigned char cmd) { RS = 0; RW = 0; LCD_DATA = cmd; EN = 1; EN = 0; delaya(1000); } /*** LCD Initialisation *******************************************/ void init_LCD(void) { LCD_DATA = (0x38); //Function set, 16x2 LCD 8bit RS = 0; RW = 0; EN = 1; EN = 0; delaya(1000); LCD_DATA = (0x0F); //Display on, cursor blinking RS = 0; RW = 0; EN = 1; EN = 0; delaya(1000); LCD_DATA = (0x01); //Clear LCD Screen RS = 0; RW = 0; EN = 1; EN = 0; delaya(1000); LCD_DATA = (0x06); //Entry Mode RS = 0; RW = 0; EN = 1; EN = 0; delaya(1000); } /*** Write a single charachter to LCD *****************************/ void writeChar_LCD(unsigned char data) <-----error here { RS = 1; RW = 0; LCD_DATA = data; <----error here EN = 1; EN = 0; delaya(1000); }