按关键词阅读: 10 驱动程序 AD TLC1543 10位AD驱动程序
1、本文格式为Word版 , 下载可任意编辑TLC1543 10位AD驱动程序TLC1543 10位AD驱动程序 调用方式:uint read1543(uchar port) 函数说明:read1543()返回10位AD芯片TLC1543的port通道采样值 。
-*/#define CLOCK P1_3#define D_IN P1_4#define D_OUT P1_5#define _CS P1_7uint read1543(uchar port) /从TLC1543读取采样值,形参port是采样的通道号uint data ad;
uint data i;
uchar data al=0,ah=0;
CL 。
【TLC1543|TLC1543 10位AD驱动程序】2、OCK=0;
_CS=0;
port=4;
for (i=0;
i4;
i+) /把通道号打入1543D_IN=(bit)(port0x80);
CLOCK=1;
CLOCK=0;
port=1;
for (i=0;
i6;
i+) /填充6个CLOCKCLOCK=1;
CLOCK=0;
_CS=1;
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_CS=0;
/等待AD转换_nop_();
_nop_();
_nop_();
for (i=0;
i2;
i+) /取D9,D8D_OUT=1;
CLOCK=1;
ah=1;
if (D_OUT) ah|=0x01;
CLOCK=0;
for (i=0;
i8;
i+) /取D7-D0D_OUT=1;
CLOCK=1;
al=1;
if (D_OUT) al|=0x01;
CLOCK=0;
_CS=1;
ad=(uint)ah;
ad=8;
ad|=(uint)al;
/得到AD值return (ad);
32021年7月 Word版本 。

稿源:(未知)
【傻大方】网址:/a/2021/0821/0023864305.html
标题:TLC1543|TLC1543 10位AD驱动程序