/***************************************/ /* C TEST PROGRAM BY RIKIYA 2010.05.12 */ /* for AKI-H8/3052F CPU BOARD */ /* PROGRAM NAME lcddisp_test.C */ /***************************************/ #include "iodefine.h" #include "myfunc.h" //#define printf ((int (*)(const char *,...))0x00002b34) //#define scanf ((int (*)(const char *,...))0x00002b86) //main ************************************************ void main(void){ char sw; // port2の入力データ格納変数 char moji[60] = "00000000001111111111222222222233333333334444444444"; // 80文字分の文字列データ P2.DDR = 0x00; // port2を全て入力に設定 P2.PCR.BYTE = 0xFF; // port2のプルアップ抵抗あり itu0_wait_init(); // 待機タイマーの初期化 lcd_init(); // lcd液晶表示器の初期化 lcd_locate(0,0); // カーソル位置の指定 lcd_print("TekuRobo"); // 文字列の表示 lcd_locate(0,1); // カーソル位置の指定 lcd_print("Ready GO!!"); // 文字列の表示 while(1){ sw = ~P2.DR.BYTE; switch (sw){ case 0xFF80: // 表示の左シフト lcd_shift_disp('l'); break; case 0x40: // 表示の右シフト lcd_shift_disp('r'); break; case 0x20: // カーソルの左シフト lcd_shift_cursor('l'); break; case 0x10: // カーソルの右シフト lcd_shift_cursor('r'); break; case 0x08: // 文字列 moji[] の表示 lcd_print(moji); break; case 0x04: // カーソルを1行目左端へ lcd_locate(0,0); break; case 0x02: // カーソルを2行目左端へ lcd_locate(0,1); break; case 0x01: // 表示クリア lcd_clear(); break; default: break; } itu0_wait(500); // 500mSの待機 } }