90 likes | 221 Views
void write_one_text(char line,char colu, char data) { write_addr_lcm(line, 4+ 6 *colu); write_lcm_command( LCM_ADDR_INC_MODE ); one_text( data); write_lcm_command( LCM_ADDR_INC_END ); }. void one_text(char ascii) { char j; write_lcm_data(0x00); for(j=0;j<5;j++) {
E N D
void write_one_text(char line,char colu, char data) • { • write_addr_lcm(line, 4+6*colu); • write_lcm_command( LCM_ADDR_INC_MODE ); • one_text( data); • write_lcm_command( LCM_ADDR_INC_END ); • }
void one_text(char ascii) • { • char j; • write_lcm_data(0x00); • for(j=0;j<5;j++) • { • write_lcm_data(font[ascii][j]); } • }
for (;;) • { • write_one_text(1,0, 0xd);//顯示學號0 • write_one_chinese(2,0, 0); //顯示姓名 • } • }
void write_one_chinese(char line,char colu, char data) • {int j; • write_addr_lcm(line,4+ 24*colu); • write_lcm_command( LCM_ADDR_INC_MODE ); • for(j=0; j<24; j++) • { • write_lcm_data(name [data] [j]); • } • write_lcm_command( LCM_ADDR_INC_END );
write_addr_lcm(line+1, 4+24*colu); • write_lcm_command( LCM_ADDR_INC_MODE ); • for(j=0;j<24;j++) //display一字 8x5 • { • //read text data=font[字的位置][第一筆資料],字的位置=page[第幾頁][第幾個字] • write_lcm_data(name [data] [j+24]); //write text • } • write_lcm_command( LCM_ADDR_INC_END );
write_addr_lcm(line+2,4+ 24*colu); • write_lcm_command( LCM_ADDR_INC_MODE ); • for(j=0;j<24;j++) //display一字 8x5 • { • //read text data=font[字的位置][第一筆資料],字的位置=page[第幾頁][第幾個字] • write_lcm_data(name [data] [j+48]); //write text • } • write_lcm_command( LCM_ADDR_INC_END ); • }
char name[2][2]= • {0,0,0,0 • };
Disp_lcm_10(int a) • { • write_one_text(1,8, (a%10)+0xd);顯示個位數 • write_one_text(1,7, (a/10%10)+0xd);顯示拾位數 • write_one_text(1,6, (a/10%100)+0xd);顯示佰位數 • }