adc0831(adc0831)
adc0831(adc0831)
ADC0832 C program
//============================================
//2005-03-28... 2005-03-29
The C51 program source file for the //ADC0834 module
//FileName=ADC083X.c
//#include
#include "DELAY_S.h""
#include "ADC083X.h""
A predefined global variable external /
//*******************************************************
/ / number:
//HD_ADC083X_S01
/ / function:
/ / port initialization
/ / input:
/ / no
/ / output:
/ / no
//********************************************************
Voidadc083x_init (void)
{
SET_ADC083X_CS;
SET_ADC083X_DO;
CLR_ADC083X_CLK;
#ifTYPE_VAL>=ADC0832.html, "target=", "_blank", "title=",
"ADC0832", ">ADC0832" and "PDF"
SET_ADC083X_DI;
#endif
#ifTYPE_VAL>=ADC0834
SET_ADC083X_SARS;
#endif
}
//*******************************************************
/ / number:
//HD_ADC083X_S02
/ / function:
Read data byte / / AD
/ / input:
The //chanel channel number and the single and double end settings are selected, whose values are limited by type values!
The effective value is select / / take a minimum of 4 and 3 respectively, 2 bit or not used
/ / specific values found in the PDF document!
/ / output:
Result bytes for //AD conversion
//********************************************************
Ucharadc083x_do_one_change (ucharchanel)
{
Uchardataad_val;
Uchardatai;
/ / initialization before conversion
SET_ADC083X_CS;
CLR_ADC083X_CLK;
SET_ADC083X_DO;
CLR_ADC083X_CS;
//SARS pins are not necessary when not in use to save pin resources!
#if (TYPE_VAL==ADC0838)
//chanel_.3.2.1.0=0000 channel 0+_ channel 1-,
=001 channel 2+_ channel 3- (double ended mode)
//SGL/DIFODD/SIGNSELECTSELECT=0010 channel 4+_ channel 5-,
=011 channel 6+_ channel 7- (double ended mode)
//=0100 channel 0-_ channel 1+,
=0101 channel 2-_ channel 3+ (double ended mode)
//=0110 channel 4-_ channel 5+,
=0111 channel 6-_ channel 7+ (double ended mode)
//=1000 channel 0+, =1001
Channel 2+ (single ended mode)
//=1010 channel 4+, =1011
Channel 6+ (single ended mode)
//=1100 channel 1+, =1101
Channel 3+ (single ended mode)
//=1110 channel 5+, =1111
Channel 7+ (single ended mode)
/ / pin /SE can be grounded, do not use the control response
byte output delay function!
Chanel|=0x10; / / additional initiation
For (i=0; i<5; i++)
{
If ((chanel&0x10) - =0)
{
SET_ADC083X_DI;
}
Else
{
CLR_ADC083X_DI;
}
seen _ adc083x _ clk;
the clr _ adc083x _ clk;
chanel < < = 1;
}
# elif (type _ val = = adc0834)
/ / chanel _.2.1.0 = 000通道0 + _ 通道1 -, = 001通道2 + _ 通
道3 -, (双端方式)
/ / sgl / difodd / signselect = 010通道0 - _ 通道1 + = 011
通道2 - _ 通
道3 + (双端方式)
/ / = 100通道0 + = 101通道2 +
(单端方式)
/ / = 110通道1 + = 111通道3 +
(单端方式)
chanel | = 0x08; / / 附加起始位
for (i = 0; i < 4; i + +)
{
if ((chanel & 0x08)! = 0)
{
seen _ adc083x _ di;
}
else
{
the clr _ adc083x _ di;
}
seen _ adc083x _ clk;
the clr _ adc083x _ clk;
chanel < < = 1;
}
# elif (type _ val = = adc0832.html _ "target =" blank "title
=" adc0832货源和pdf资料 "> adc0832)
/ / chanel _.1.0 = 00通道0 + _ 通道1 -, = 01通道0 - _ 通道
1 + (双端方式)
/ / sgl / difodd / sign = 10通道0 + = 11通道1 +
(单端方式)
chanel | = 0x04; / / 附加起始位
for (i = 0; i < 3; i + +)
{
if ((chanel & 0x04)! = 0)
{
seen _ adc083x _ di;
}
else
{
the clr _ adc083x _ di;
}
seen _ adc083x _ clk;
the clr _ adc083x _ clk;
chanel < < = 1;
}
# else / / 缺省时为adc0831
seen _ adc083x _ clk;
the clr _ adc083x _ clk;
# endif
seen _ adc083x _ clk; / / 数据接收前的转换位
the clr _ adc083x _ clk;
for (ad _ val = 0, i = 0; i < 8; i + +)
{
ad _ val < < = 1;
seen _ adc083x _ clk;
ad _ val + = (judge _ adc083x _ do = = 1? 1: 0);
the clr _ adc083x _ clk;
}
/ / 对非adc0831的型号而言, 后续波形没有使用!
seen _ adc083x _ cs;
return (ad _ val);
}
/ / = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= = = = = =
/ / endoffile
adc0832.html _ "target =" blank "title =" adc0832货源和pdf
资料 "> adc0832 为8位分辨率a / d转换芯片, 其最高分辨可达256级, 可以适应
一般的模拟量转换要求.其内部电源输入与参考电压的复用, 使得芯片的模拟
电压输入在0 ~ 5v之间.芯片转换时间仅为32μs, 据有双数据输出可作为数据
校验, 以减少数据误差, 转换速度快且稳定性能强.独立的芯片使能输入, 使
多器件挂接和处理器控制变的更加方便.通过di 数据输入端, 可以轻易的实现
通道功能的选择. window.google _ running _ ad ();
本文档为【adc0831(adc0831)】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。