kasoma
Newbie level 6
Hi all
I am working on source code to display Characters on a 16x2 LCD using a PIC18F4550 microcontroller.
I am using MPLAB IDE with C18 compiler. I am writing my source code and on compiling I get the Error [1151] struct or union object designator expected.
When I looked up the error in the MPLAB CI8 users guide I found this message
"1151: struct or union object designator expected
The member access operators, '.' and '->' require operands of struct/union
and pointer to struct/union, respectively."
I think the library function miss some operands but I don't really know how to include those operands.
Please help me debug this code
Here is the source code
ON BUILDING THESE ARE THE RESULTS
Anyone who understands what this error wants please help me.
---------- Post added at 06:30 ---------- Previous post was at 06:13 ----------
Please someone give me an idea on what I should do . I am waiting
I am working on source code to display Characters on a 16x2 LCD using a PIC18F4550 microcontroller.
I am using MPLAB IDE with C18 compiler. I am writing my source code and on compiling I get the Error [1151] struct or union object designator expected.
When I looked up the error in the MPLAB CI8 users guide I found this message
"1151: struct or union object designator expected
The member access operators, '.' and '->' require operands of struct/union
and pointer to struct/union, respectively."
I think the library function miss some operands but I don't really know how to include those operands.
Please help me debug this code
Here is the source code
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 #include <p18cxxx.h> #pragma config CPUDIV = OSC1_PLL2 #pragma config WDT = OFF #pragma config LVP = OFF #pragma config DEBUG = OFF #pragma config MCLRE = ON //static bit LCD_RS @ ((unsigned)&PORTA*8+4) //static bit LCD_EN @ ((unsigned)&PORTA*8+5) #define LCD_RS LATABits.LATB4 #define LCD_EN LATABits.LATB5 //#define LCD_RS LATA.F4 //#define LCD_EN LATA.F5 #define LCD_STROBE ((LCD_EN = 1), (LCD_EN = 0)) //void lcd_write (unsigned char); //void lcd_clear (void); //void lcd_puts(const char * s); //void lcd_goto(unsigned char pos); void main(void) { void lcd_init (void); LATA = 0x00; TRISA = 0x00; LATB = 0x00; TRISB = 0x00; lcd_init(); } void lcd_init(void) { LCD_RS = 0; // write control bytes DelayMs(15); // power on delay PORTB = 0x3; // attention! LCD_STROBE; DelayMs(5); LCD_STROBE; DelayUs(100); // LCD_STROBE; LCD_EN = 1; LCD_EN = 0; DelayMs(5); PORTB = 0x2; // set 4 bit mode LCD_STROBE; DelayUs(40); lcd_write(0x28); // 4 bit mode, 1/16 duty, 5x8 font lcd_write(0x08); // display off lcd_write(0x0F); // display on, blink curson on lcd_write(0x06); // entry mode }
ON BUILDING THESE ARE THE RESULTS
Code:
Debug build of project `C:\Users\tx2AKE\Documents\PIC\works\display.mcp' started.
Language tool versions: mpasmwin.exe v5.42, mplink.exe v4.40, mcc18.exe v3.40, mplib.exe v4.40
Preprocessor symbol `__DEBUG' is defined.
Sat Mar 10 20:58:22 2012
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean Warning: File "C:\Users\tx2AKE\Documents\PIC\works\display2.o" doesn't exist.
Clean: Deleted file "C:\Users\tx2AKE\Documents\PIC\works\display.mcs".
Clean: Done.
Executing: "C:\MCC 18\bin\mcc18.exe" -p=18F4450 /i"C:\MCC 18\h" "display.c" -fo="display.o" -D__DEBUG -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
C:\Users\tx2AKE\Documents\PIC\works\display.c:55:Error [1203] too few arguments in function call
C:\Users\tx2AKE\Documents\PIC\works\display.c:57:Error [1203] too few arguments in function call
C:\Users\tx2AKE\Documents\PIC\works\display.c:67:Error [1151] struct or union object designator expected
C:\Users\tx2AKE\Documents\PIC\works\display.c:67:Error [1151] struct or union object designator expected
C:\Users\tx2AKE\Documents\PIC\works\display.c:69:Error [1151] struct or union object designator expected
C:\Users\tx2AKE\Documents\PIC\works\display.c:69:Error [1151] struct or union object designator expected
C:\Users\tx2AKE\Documents\PIC\works\display.c:70:Warning [2058] call of function without prototype
C:\Users\tx2AKE\Documents\PIC\works\display.c:80:Error [1151] struct or union object designator expected
C:\Users\tx2AKE\Documents\PIC\works\display.c:82:Warning [2058] call of function without prototype
C:\Users\tx2AKE\Documents\PIC\works\display.c:89:Error [1151] struct or union object designator expected
C:\Users\tx2AKE\Documents\PIC\works\display.c:100:Error [1151] struct or union object designator expected
C:\Users\tx2AKE\Documents\PIC\works\display.c:108:Error [1151] struct or union object designator expected
C:\Users\tx2AKE\Documents\PIC\works\display.c:109:Warning [2058] call of function without prototype
C:\Users\tx2AKE\Documents\PIC\works\display.c:111:Error [1151] struct or union object designator expected
C:\Users\tx2AKE\Documents\PIC\works\display.c:111:Error [1151] struct or union object designator expected
C:\Users\tx2AKE\Documents\PIC\works\display.c:112:Warning [2058] call of function without prototype
C:\Users\tx2AKE\Documents\PIC\works\display.c:113:Error [1151] struct or union object designator expected
C:\Users\tx2AKE\Documents\PIC\works\display.c:113:Error [1151] struct or union object designator expected
C:\Users\tx2AKE\Documents\PIC\works\display.c:114:Warning [2058] call of function without prototype
C:\Users\tx2AKE\Documents\PIC\works\display.c:115:Error [1151] struct or union object designator expected
C:\Users\tx2AKE\Documents\PIC\works\display.c:115:Error [1151] struct or union object designator expected
C:\Users\tx2AKE\Documents\PIC\works\display.c:116:Warning [2058] call of function without prototype
C:\Users\tx2AKE\Documents\PIC\works\display.c:118:Error [1151] struct or union object designator expected
C:\Users\tx2AKE\Documents\PIC\works\display.c:118:Error [1151] struct or union object designator expected
C:\Users\tx2AKE\Documents\PIC\works\display.c:119:Warning [2058] call of function without prototype
Halting build on first failure as requested.
----------------------------------------------------------------------
Debug build of project `C:\Users\tx2AKE\Documents\PIC\works\display.mcp' failed.
Language tool versions: mpasmwin.exe v5.42, mplink.exe v4.40, mcc18.exe v3.40, mplib.exe v4.40
Preprocessor symbol `__DEBUG' is defined.
Sat Mar 10 20:58:23 2012
----------------------------------------------------------------------
BUILD FAILED
Anyone who understands what this error wants please help me.
---------- Post added at 06:30 ---------- Previous post was at 06:13 ----------
Please someone give me an idea on what I should do . I am waiting
Last edited by a moderator: