Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

a problem when i build my project

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&#39;:

../hello_world.c:32: error: parse error before &#39;;&#39; token

../hello_world.c:35: error: parse error before &#39;;&#39; token

../hello_world.c:37: error: parse error before &#39;;&#39; token

../hello_world.c:40: error: parse error before &#39;;&#39; token

../hello_world.c: In function `init_lcd&#39;:

../hello_world.c:46: error: parse error before &#39;;&#39; token

../hello_world.c:47: error: parse error before &#39;;&#39; token

../hello_world.c:48: error: parse error before &#39;;&#39; token

../hello_world.c:49: error: parse error before &#39;;&#39; 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

5 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    No line number in your codes, So I cannot find which line is missing ";" or something else.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You could try removing the ";" from you# define statements e.g.

    # define ccomm 0x00# define cdata 0x01

    Hope this helps
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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.