//********************************************************************** /*  GLCD(SG12864A) PIC16F88  2009/9/28 BY M.Kikuchi */ //********************************************************************** // GLCDの初期化 char GLCD_DataPort at PORTB; sbit GLCD_CS1 at RA7_bit; sbit GLCD_CS2 at RA6_bit; sbit GLCD_RS at RA4_bit; sbit GLCD_RW at RA3_bit; sbit GLCD_EN at RA2_bit; sbit GLCD_RST at RA0_bit; sbit GLCD_CS1_Direction at TRISA7_bit; sbit GLCD_CS2_Direction at TRISA6_bit; sbit GLCD_RS_Direction at TRISA4_bit; sbit GLCD_RW_Direction at TRISA3_bit; sbit GLCD_EN_Direction at TRISA2_bit; sbit GLCD_RST_Direction at TRISA0_bit; //********************************************************************** void SwitchONcheck() //SW が押されたらループを抜ける { while (Button(&PORTA, 5, 1, 0) == 0) ; while (Button(&PORTA, 5, 1, 1) == 0) ; } //********************************************************************** void main() { static unsigned short j, k; // OSCCON = 0b01110000; // クロックを8Mhzに設定する。 ANSEL = 0b00000000; // A/D変換は使用しない。 //ポートの設定 TRISA = 0b00100000; TRISB = 0b00000000; PORTA = 0b00000000; PORTB = 0b00000000; // Glcd_Init(&PORTA,7,6,4,3,0,2,&PORTB); // cs1,cs2,rs,rw,rst,en Glcd_Init(); Glcd_Fill(0xff); Glcd_Write_Text("GLCD START 09'09",5, 4, 0); //横/5行目/set bit while (1) { SwitchONcheck(); //テキストを表示 :カナ文字を使うと画面は停止する、エラー Glcd_Fill(0); Glcd_Write_Text("BY M.Kikuchi", 0, 0, 1); for (j = 2; j < 8; j++) { Glcd_Write_Text("JA1HWO", j * 10, j, 1); } SwitchONcheck(); //円を表示 Glcd_Fill(0); Glcd_Circle(15, 31, 12, 1); Glcd_Circle(110, 31, 12, 1); for (j = 4; j < 31; j += 4) { Glcd_Circle(63, 31, j, 1); } SwitchONcheck(); //ドットを表示 Glcd_Fill(0); for (j = 0; j < 128; j += 10) { for (k = 0; k < 64; k += 10) { Glcd_Dot(j, k, 1); } } // whileへ戻る } } //**********************************************************************