- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
my program as follows:# 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; } the errors as follows: **** 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
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you have to control ";" , not "," at the end of# define
not ";" after } try this.
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