//************************************************************* // I2C LCD ライブラリ PIC18 Ver 1.0 20110320 // 以下の機能を提供する 18F26J50 // // LCD_int() ----- 初期化 // LCD_cmd(cmd) ----- コマンド出力 // LCD_dat(chr) ----- 1文字表示 // LCD_str(*str) ----- 文字列表示 RAM // LCD_ROMstr(*str) -- 文字列表示 ROM // LCD_posyx(y,x) ---- カーソル位置指定、行 y、横位置 x // LCD_clr() ----- 全消去 // LCD_icon_on(icn); -- 指定アイコン ON // LCD_icon_off(icn);-- 指定アイコン OFF // LCD_icon_clr();----- 全アイコン OFF // //液晶表示器とPICはI2Cにより接続される // 1)Define I/O PORT // PORTB(5)pin26 : SDA1 // PORTB(4)pin25 : SCL1 // 2)OSC // 内部クロック 4MHz // //************* Delay ******************************************* // 必要とするディレイ時間をクロック周波数から計算し、指定する // 命令サイクル(TCY)は、クロック 4個分の時間である。 // 動作クロック変更した場合には、下記を参照し // ** Delay Define ** を変更すること // //  例 Clock = 4Mhz instruction cycle = 1Mhz (1μSec) // Clock --4Mhz--- --40Mhz-- --48Mhz-- // Delay1TCY 1μSec 0.1μSec 80nSec // Delay10TCYx 10μSec 1μSec 0.8μSec // Delay100TCYx 100μSec 10μSec 8μSec // Delay1KTCYx 1mSec 0.1mSec 80μSec // Delay10KTCYx 10mSec 1mSec 0.8mSec // //*************** Delay Define ******************************* #define Delay_50uS Delay10TCYx(5) #define Delay_2mS Delay1KTCYx(2) #define Delay_100mS Delay1KTCYx(100) //******************************** // 調整用定数 //********************************* //#define CONTRAST 0x18 // for 5V #define CONTRAST 0x2D // for 3.3V //******************************** // アイコン定数 //********************************* #define i_Ant 0x4010 // アンテナ #define i_Tel 0x4210 // 電話 #define i_Aud 0x4410 // 音声 #define i_Pulg 0x4610 // 接続 #define i_Up 0x4710 // Up #define i_Dn 0x4708 // Down #define i_UpDn 0x4718 // Down #define i_Lock 0x4910 // 鍵 #define i_XFlag 0x4B10 // X旗 #define i_BatEMP 0x4D02 // バッテリー空 #define i_BatLOW 0x4D12 // バッテリー小 #define i_BatMID 0x4D1A // バッテリー中 #define i_BatFUL 0x4D1E // バッテリー満 #define i_Circle 0x4F10 // 三重丸 //******************* 提供機能 ******************************* void LCD_dat(char chr); void LCD_cmd(char cmd); void LCD_clr(void); void LCD_int(void); void LCD_str(char *str); void LCD_ROMstr(rom const char *); void LCD_posyx(char,char); void LCD_icon_on(int icn); void LCD_icon_off(int icn); void LCD_icon_clr(void); void LCD_hex(char); char LCD_hxH(char); char LCD_hxL(char);