资源描述:
《智能仪器仪表程序》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、智能仪器仪表程序#include"Table.c"#include#include"Intrins.h"voidSwitchRes_Chnl();voidSwitchRes_Rly();voidSwitchRes_Dsp();sbitMotor_CW=P3^7;sbitMotor=P3^6;sbitRLY_100=P1^0;sbitRLY_1K=P1^1;sbitRLY_10K=P1^2;sbitRLY_100K=P3^0;sbitRLY_1M=P3^1;sbitRLY_10M=P1^3;voidHex2BcdExt(unsignedintHex,unsignedc
2、har*BcdPtr)unsignedcharTemp;Temp=Hex%100;*BcdPtr=Hex/100;++BcdPtr;*BcdPtr=(Temp)/10;++BcdPtr;*BcdPtr=(Temp)%10;}//测试开始voidKeyFuncDraw(){clearscr();IsDraw=~IsDraw;if(IsDraw){DrawCor();StartMotor();DrawCol=0;}else{StopMotor();//TR0=0;DrawCol=0;}}//设置和确定voidKeyFuncCfg(){if(IsCfg==1){ResPick=Bcd2HexExt(
3、DspBuf);ResError=Bcd2HexExt(DspBuf+DSPBUF_ERROR);LCD_ReverseText(LCD_PICK_COL,LCD_PICK_LINE,0);LCD_ReverseText(LCD_PICK_COL+1,LCD_PICK_LINE,0);LCD_ReverseText(LCD_PICK_COL+2,LCD_PICK_LINE,0);LCD_ReverseText(LCD_PICK_COL+3,LCD_PICK_LINE,0);//确定时清除LCD_ReverseText(LCD_PICK_COL+1,LCD_PICK_LINE,0);LCD_Re
4、verseText(LCD_PICK_COL+2,LCD_PICK_LINE,0);//确定时清除LCD_ReverseText(LCD_ERROR_COL,LCD_ERROR_LINE,0);LCD_ReverseText(LCD_ERROR_COL+1,LCD_ERROR_LINE,0);LCD_ReverseText(LCD_ERROR_COL+2,LCD_ERROR_LINE,0);//确定时清除}else{LCD_ReverseText(LCD_PICK_COL,LCD_PICK_LINE,1);//设置时反显}IsCfg=~IsCfg;InputIndex=0;}//取消voidK
5、eyFuncCncl(){IsCfg=0;LCD_ReverseText(4,4,0);LCD_ReverseText(5,4,0);LCD_ReverseText(6,4,0);//取消时清除InputIndex=0;}voidKeyFuncRes(){++ResSelect;if(ResSelect>RES_MAX){ResSelect=0;}SwitchRes_Rly();{if(UnitNow==UNIT_OHM){if(ResSelect==RES_100){ResResult=ResNow;}if(ResSelect==RES_1K){ResResult=ResNow*10;}}i
6、f(UnitNow==UNIT_KOHM){if(ResSelect==RES_10K){ResResult=ResNow*100;}}}voidCvtResPick(){if(UnitPick==UNIT_OHM){if(DotIndex==2){PickResult=ResPick;}if(DotIndex==0){PickResult=ResPick*10;}}if(UnitPick==UNIT_KOHM){if(DotIndex==1){PickResult=ResPick*100;}if(DotIndex==2){PickResult=ResPick*1000;}}}voidDraw
7、Res(){switch(ResSelect){caseRES_100:ResNow=ChkRes(ADFinal,ResTab_100)+11;break;caseRES_1K:ResNow=ChkRes(ADFinal,ResTab_1K);if(ADFinal<53){ResNow=0;}break;caseRES_10K:ResNow=ChkRes(ADFinal,ResTab_10K);