//********************************************************************** /*   <LCD制御ライブラリ(mikroCコンパチブル)> */ //********************************************************************** //■■■関数宣言■■■ extern void main(); extern void opening_demonstration(); //********************************************************************** //■■■インクルード■■■ #include "lcd_lib_4bit.h" //********************************************************************** //■■■マクロ定義■■■ sbit LCD_RS at RA6_bit; sbit LCD_EN at RA7_bit; sbit LCD_D7 at RB7_bit; sbit LCD_D6 at RB6_bit; sbit LCD_D5 at RB5_bit; sbit LCD_D4 at RB4_bit; // Pin direction sbit LCD_RS_Direction at TRISA6_bit; sbit LCD_EN_Direction at TRISA7_bit; sbit LCD_D7_Direction at TRISB7_bit; sbit LCD_D6_Direction at TRISB6_bit; sbit LCD_D5_Direction at TRISB5_bit; sbit LCD_D4_Direction at TRISB4_bit; //********************************************************************** //■■■メイン関数■■■ void main() { char buf[16]; double ad; // OSCCON = 0b01110000; ANSEL = 0b00001111; TRISA = 0b00101111; TRISB = 0b00000000; // Lcd2_Init(); Lcd2_Cmd(_LCD_CLEAR); Lcd2_Cmd(_LCD_CURSOR_OFF); // opening_demonstration(); // Lcd2_Out(1, 6, "mV"); Lcd2_Out(1, 14, "mV"); Lcd2_Out(2, 6, "mV"); Lcd2_Out(2, 14, "mV"); while (1) { ad = Adc_Read(0); ad *= 4.8828125; WordToStr(ad, buf); Lcd2_Out(1, 1, buf); // ad = Adc_Read(1); ad *= 4.8828125; WordToStr(ad, buf); Lcd2_Out(1, 9, buf); // ad = Adc_Read(2); ad *= 4.8828125; WordToStr(ad, buf); Lcd2_Out(2, 1, buf); // ad = Adc_Read(3); ad *= 4.8828125; WordToStr(ad, buf); Lcd2_Out(2, 9, buf); // Delay_ms(500); } } //********************************************************************** //■■■オープニングデモ関数■■■ void opening_demonstration() { short cnt; // Lcd2_Chr(1, 1, 'j'); Lcd2_Chr(1, 2, 'f'); Lcd2_Chr(1, 3, '3'); Lcd2_Chr(1, 4, 's'); Lcd2_Chr(1, 5, 'f'); Lcd2_Chr(1, 6, 'b'); Delay_ms(1000); // Lcd2_Chr_Cp(' '); Lcd2_Chr_Cp('J'); Lcd2_Chr_Cp('F'); Lcd2_Chr_Cp('3'); Lcd2_Chr_Cp('S'); Lcd2_Chr_Cp('F'); Lcd2_Chr_Cp('B'); Delay_ms(1000); // Lcd2_Out(2, 1, "JF3SFB"); Delay_ms(1000); // Lcd2_Out_Cp(" jf3sfb"); Delay_ms(1000); // Lcd2_Cmd(_LCD_CLEAR); for (cnt = 0; cnt < 16; cnt++) { Lcd2_Chr(1, cnt + 1, 0xFF); Delay_ms(100); } for (cnt = 0; cnt < 16; cnt++) { Lcd2_Chr(2, cnt + 1, 0xFF); Delay_ms(100); } Delay_ms(1000); // for (cnt = 0; cnt < 10; cnt++) { Lcd2_Cmd(_LCD_TURN_OFF); Delay_ms(100); Lcd2_Cmd(_LCD_TURN_ON); Delay_ms(100); } // Lcd2_Cmd(_LCD_RETURN_HOME); for (cnt = 0; cnt < 16; cnt++) { Lcd2_Chr(1, cnt + 1, ' '); Delay_ms(100); } for (cnt = 0; cnt < 16; cnt++) { Lcd2_Chr(2, cnt + 1, ' '); Delay_ms(100); } Delay_ms(1000); } //**********************************************************************