欢迎来到天天文库
浏览记录
ID:15646893
大小:229.00 KB
页数:29页
时间:2018-08-04
《电子星系工程pic程序》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、#include#include#defineRSPINPORTBbits.RB5//DataorInstrumentSelect#defineRWPINPORTBbits.RB4//WriteorRead#defineEPINPORTBbits.RB3//6800modeEnablesingle#defineINPUTPORTBbits.RB2#definecoldPORTBbits.RB6#definewarmPORTBbits.RB7#defineSTSPORTAbits.RA0#define
2、CSPORTAbits.RA1#defineA0PORTAbits.RA2#defineCEPORTAbits.RA3#defineRCPORTAbits.RA4voidInterruptHandlerHigh(void);#defineucharunsignedchar//宏定义#defineuintunsignedint#defineK_UP0X20//定义键值#defineK_DOWN0X21#defineK_CLEAR0X24#defineK_OK0X25#defineK_ONE0X30#defineK_FOUR0X31#defin
3、eK_SEVEN0X32#defineK_POINT0X33#defineK_TWO0X34#defineK_FIVE0X43#defineK_EIGHT0X36#defineK_ZERO0X37#defineK_THREE0X38#defineK_SIX0X40#defineK_NINE0X41#defineK_SET0X42#include"key.h"////////////////////全局变量/////////////////////////////unsignedintTimeout;floatTEMP_NOW=0.0;flo
4、atTEMP_SET=21.0;uintT_Count=0;uintS_Count=0;uintP_Count=0;uintN_Count=0;uintM_Count=1;ucharCurrent_Temp_Display_Buffer[]={"NOW:-23.5"};ucharset_Temp_Display_Buffer[]={"SET:21.0"};intsel=0;voidComparison();//////////////////////定时///////////////////////////////voidtimer0_in
5、it(void){Timeout=0;INTCON=0x20;//disableglobalandenableTMR0interruptINTCON2=0x84;//TMR0highpriorityRCONbits.IPEN=1;//enableprioritylevelsTMR0H=0;//cleartimerTMR0L=0;//cleartimerT0CON=0x82;//setuptimer0-prescaler1:8INTCONbits.GIEH=1;//enableinterruptsTRISD=0;/*configurePORT
6、Dforoutput*/PORTD=0X00;if(Timeout==1){//timeout?Timeout=0;//cleartimeoutindicorRead_Temperature();Display_Temperature();N_Count=1;}}//Highpriorityinterruptvector//PIC中断标准服务程序#pragmacodeInterruptVectorHigh=0x08//中断向量voidInterruptVectorHigh(void){_asmgotoInterruptHandlerHigh
7、//jumptointerruptroutine_endasm}//----------------------------------------------------------------------------//Highpriorityinterruptroutine//中断服务程序#pragmacode#pragmainterruptInterruptHandlerHighvoidInterruptHandlerHigh(){if(INTCONbits.TMR0IF){//checkforTMR0overflowINTCONb
8、its.TMR0IF=0;//clearinterruptflagTimeout=1;//indicatetimeout}}voidComparison(){if(N_Count
此文档下载收益归作者所有