原创 LCD显示程序

2007-8-5 17:46 5166 4 4 分类: 汽车电子

PIC单片机应用程序1:


LCD显示程序


#include <16F877.h>
#device adc="10"
#use delay(clock=20000000)
#fuses NOWDT,HS, NOPUT, NOPROTECT, NOBROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG


#use fast_io(A)
#use fast_io(B)
#use fast_io(C)


//#define  AMODE    0X3F
//#define  BMODE    0X00
//#define  CMODE    0X00


//#include "C:\JCYCAD\new\new.h"


#include <lcd_lib_mo.c>
/*
#int_RTCC
RTCC_isr() {


}
*/
void  lcd_dsply00(void)
     {
      lcd_cursor_posi(1,1);printf(lcd_data,"********************");
      lcd_cursor_posi(1,2);printf(lcd_data,"   Hello!  Clarion  ");
      lcd_cursor_posi(1,3);printf(lcd_data,"    PWB-PIN-BASE    ");
      lcd_cursor_posi(1,4);printf(lcd_data,"********************");
     }
void  lcd_dsply01(void)
      {
      lcd_cursor_posi(1,1);printf(lcd_data,"********************");
      lcd_cursor_posi(1,2);printf(lcd_data,"    PWB-PIN-BASE    ");
      lcd_cursor_posi(1,3);printf(lcd_data,"       CHECKER      ");
      lcd_cursor_posi(1,4);printf(lcd_data,"********************");
      }


void main() {


   //set_tris_a(AMODE);
   //set_tris_b(BMODE);
   //set_tris_c(CMODE);



   set_tris_a(3f);
   set_tris_b(0);
   set_tris_c(0);
   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_psp(PSP_DISABLED);
   setup_spi(FALSE);
   setup_counters(RTCC_INTERNAL,RTCC_DIV_4);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   enable_interrupts(INT_RTCC);
   enable_interrupts(GLOBAL);
   output_B(0);
   output_C(0);
   //output_D(0);


   lcd_init();
   lcd_clear();



   While(1)
   {
   lcd_dsply00();
   delay_ms(2000);
   lcd_clear();
   lcd_dsply01();
   delay_ms(2000);
   lcd_clear();
   }


}


 

文章评论0条评论)

登录后参与讨论
我要评论
0
4
关闭 站长推荐上一条 /2 下一条