基于51的ads1115程序.docx
《基于51的ads1115程序.docx》由会员分享,可在线阅读,更多相关《基于51的ads1115程序.docx(13页珍藏版)》请在第壹文秘上搜索。
1、*/_*功能:ADS1115单端输入检测电压】./;._*Cpu:STC12C5A60S2*m*/;_*ADC芯片:【ADS1115(2差分输入或者4单端输入)】*._二一*液晶.*/fLCD1602J*_-*/*.*ADC与单片机连接:SCkPLOzSDAiPl.1*.*/*一* 检测范围:0.004.99V*/#include/include#defineuintunsignedintftdefineucharunsignedchar#define_Nop()_nop_()i以下为LCDI602显示模块端口定义及函数声明*/sbit lcd_rs_port = Pl7;sbit lcd_r
2、w_port = P16;sbit lcd_en_port = P24;#define lcd_data_port PO*定义LCD控制端口*/67.9AB电压显示框架电压显示位置voidlcd_delay(ucharms);/LCD1602延时voidlcd_busy_wait();/LCD1602忙等待voidlcd_command_write(ucharcommand);/LCD1602命令字写入voidlcd_system_reset);/LCD1602初始化voidlcd_char_write(ucharx-poszy-pos,lcd-dat);/LCD1602字符写入voidlcd
3、_bad_check();/LCD1602坏点检查voidNum_to_Disp(uintNum);/LCD1602数据处理voidLcdDisp(uintnum);/LCD1602数据显示voiddelay_lms(uchar);/LCD1602延时Ims/*以下为ADSIII5模块端口定义及函数声明*/sbitSCL=P10;sbitSDA=P11;#defineTRUE1#defineFALSE0unsignedintConfig;unsigned int Result2;int D_ADS;ftdefine Accuracy 32768 char VCC = 4.78;unsigned
4、charWritebuff4zReadbuff3;转换的数字量定义ADC精度,ADS1115单端输入时15位/VCC,电压参考值/ADDR PIN -GND /ADDR PIN -VDD /ADDR PIN -SDA /ADDR PIN -SCL#defineADDRESS_O0x90#defineADDRESS_10x92#defineADDRESS_20x94#defineADDRESS_30x96POINTERREGISTER*/Convertion register /Config register /Lo_thresh register /HLthresh register#defi
5、nePointer_0#definePointer_lOXol#definePointer_22#definePointer_30x03/CONFIGREGISTER*/#defineOS_00x0000#defineOS_10x8000#define MUX_0#define MUX_1 ftdefine MUX_2#define MUX_3#define MUX_40x00000x10000x20000x30000x4000#define MUX_5 0x5000#define MUX_6 0x6000#define MUX_7 0x7000/ANp=AIN0z AINn=AINl /AN
6、p=AIN0z AINn=AIN3 AINP=AlN1, AINn=AIN3 /AINp=AIN2z AINn=AIN3 /AINp=AIN0, AINn=GND /ANp=AINlz AINn=GND /AINp=AIN2z AINn=GND /AINp=AIN3z AINn=GND#definePGA_00x0000/FS=6.144V#definePGA_10x0200/FS=4.096V#definePGA_20x0400/FS=2.048V#definePGA_30x0600/FS=1.024V#definePGA_40x0800/FS=0.512V#definePGA_5OxOAO
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 基于 51 ads1115 程序