欢迎来到天天文库
浏览记录
ID:61482849
大小:33.00 KB
页数:9页
时间:2021-02-04
《PIC18单片机LCD液晶显示器驱动程序.doc》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、//***********************************************//*Main.C*//***********************************************//*W-AP002MPLABC18AdvanceWorkshop*//*Writtenby:RichardYang*//*Sr.CorporateApplicationsEngr.*//*MicrochipTechnologyInc.*//*Date:16January2003*//*Revision:1*//*****************************
2、******************//***********************************************************#include#include#include"P18F_LCD.h"voidInitializePORT(void);#pragmaidataaccessMy_RAM_1nearcharLCD_RAM_MSG[]="RichardYang";nearunsignedcharLCD_Char='0';#pragmaromdataRomDataconstromcharLCD_ROM_M
3、SG[]="WAP-002Workshop";#pragmacode//***********************************************************/**//*MainProgram*//**///***********************************************************voidmain(void){InitializePORT();OpenLCD();putcLCD('!');while(1);}//************************************************
4、//*Function:InitializePORT*//************************************************voidInitializePORT(void){PORTA=0x00;TRISA=0b;//RA2asLCD-Econtrol,RA5asCSControlforSPIPORTD=0x00;TRISD=0x00;//SetPORTDasOutputport}#pragmacode#pragmaromdataCONFIGconstromunsignedcharCONFIG1L=0xff;//Don'tcarebyteconstro
5、munsignedcharCONFIG1H=0b;//DisableOSCswitch,XXXXX010=HSOscconstromunsignedcharCONFIG2L=0b;//DisablePWRT,DisableBORconstromunsignedcharCONFIG2H=0b;//DisableWDTtimerconstromunsignedcharCONFIG3L=0xff;//Don'tcarebyteconstromunsignedcharCONFIG3H=0b;//XXXXXXX0=CCP2-->RB3constromunsignedcharCONFIG4L=
6、0b;//0XXXXXXXBackgroungDebugEnable(ICD)constromunsignedcharCONFIG4H=0xff;//Don'tcarebyteconstromunsignedcharCONFIG5L=0b;//NotPROGcodeprotectedconstromunsignedcharCONFIG5H=0b;//NotEEPROMcodeprotectedconstromunsignedcharCONFIG6L=0b;constromunsignedcharCONFIG6H=0b;constromunsignedcharCONFIG7L=0b;
7、constromunsignedcharCONFIG7H=0b;#pragmaromdata//DeclarationfileforLCDrelatedsubroutinesvoidOpenLCD(void);voidWriteCmdLCD(unsignedchar);voidWriteDataLCD(unsignedchar);voidputsLCD(char*);voidputrsLCD(constromchar*);voidputcLCD(unsignedcha
此文档下载收益归作者所有