- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
my program:#include "system.h"# include "altera_avalon_pio_regs.h"# include "alt_types.h"# define ccomm 0x00;# define cdata 0x01;
void init_lcd(void); void write_lcd(alt_u8 data_comm,alt_u8 content); void clk_busy(void); void delay(alt_u8 us); void disp(void); void busy_check(void); alt_u8 ch_busy; alt_u8 data_disp[33]= { 0x02,0x00,0x01,0x08,0x7F,0xFC,0x00,0x00,0x00,0x00,0x1F,0xF0,0x10,0x10,0x10,0x10, 0x1F,0xF0,0x01,0x00,0x09,0x30,0x19,0x18,0x31,0x0C,0x41,0x08,0x05,0x00,0x02,0x00 }; int main(void) { init_lcd(); delay(10); disp(); return (0); } void disp(void) { alt_u8 i; write_lcd(ccomm,0x80); for(i=0;i<16;i++) { write_lcd(cdata,data_disp);}
write_lcd(ccomm,0x90);
for(i=0;i<16;i++)
{
write_lcd(cdata,data_disp); } } void init_lcd(void) { IOWR(RS_RW_BASE,0,0x00); write_lcd(ccomm,0x30); write_lcd(ccomm,0x01); write_lcd(ccomm,0x06); write_lcd(ccomm,0x0c); } void delay(alt_u8 num) {while(num--) ; } void write_lcd(alt_u8 data_comm,alt_u8 content) {alt_u8 check_num; if(ch_busy) {for(check_num=10;check_num>0;check_num--) { if(data_comm) {IOWR(RS_RW_BASE,0,2); IOWR(LCD_EN_BASE,0,1); } else {IOWR(RS_RW_BASE,0,0); IOWR(LCD_EN_BASE,0,1); } IOWR(DATA_BASE,0,content); delay(10); IOWR(LCD_EN_BASE,0,0); } } else { if(data_comm) {IOWR(RS_RW_BASE,0,2); IOWR(LCD_EN_BASE,0,1); } else {IOWR(RS_RW_BASE,0,0); IOWR(LCD_EN_BASE,0,1); } IOWR(DATA_BASE,0,content); delay(10); IOWR(LCD_EN_BASE,0,0); } } void busy_check(void) { alt_u8 temp; IOWR(RS_RW_BASE,0,1); IOWR(LCD_EN_BASE,0,1); temp=IORD(DATA_BASE,0); IOWR(LCD_EN_BASE,0,0); ch_busy=temp&0x80; } when i built my project the system hinted following errors : **** Incremental build of configuration Debug for project lcd **** make -s all Compiling hello_world.c... ../hello_world.c: In function `disp': ../hello_world.c:32: error: parse error before ';' token ../hello_world.c:35: error: parse error before ';' token ../hello_world.c:37: error: parse error before ';' token ../hello_world.c:40: error: parse error before ';' token ../hello_world.c: In function `init_lcd': ../hello_world.c:46: error: parse error before ';' token ../hello_world.c:47: error: parse error before ';' token ../hello_world.c:48: error: parse error before ';' token ../hello_world.c:49: error: parse error before ';' token ../hello_world.c:99:7: warning: no newline at end of file make: *** [obj/hello_world.o] Error 1 Build completed I wanna know how to solve this problem. thx v much
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wow, this is a large program listing and it is all jumbled together. http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/blink.gif I tried looking at the code you are writing, however, I couldn't find anything too obvious.
Can you provide us with what comes on the line just before line# 32 in the code display? This would help to zero in on the problem. http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/wink.gif Tnx.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No line number in your codes, So I cannot find which line is missing ";" or something else.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You could try removing the ";" from you# define statements e.g.
# define ccomm 0x00# define cdata 0x01 Hope this helps- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You HAVe to remove the ";" from your defines. I had the same problem and got almost mad, until i found a "," after define.
After a# never use a semicolon.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you all. i have solved it according your help.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page