⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ad7783.c

📁 AD7783模数转换程序
💻 C
字号:
/*********************************************************************

 Author        : ADI - Apps            www.analog.com/MicroConverter

 Date          : September 2003

 File          : AD7783.c

 Hardware      : ADUC832 is used to control ad7709.The core clock of ADUC832 is 2.097152MHZ.

 Description   :

*********************************************************************/

#include<stdio.h>
#include<aduc832.h>
/******************************************************************
DEFINE CONTROL PINS OF ADUC832 FOR THE PURPOSE OF AD7783 CONTROL.
Customers should define the pins according to their design.
If P0 is used as the control port, pull-up resistors should be added to each pin of P0.
******************************************************************/
sbit CS=0x085;

sbit DOUT=0x0B5;
sbit DRDY=0x0B3;
sbit RESET=0x084;
sbit SCLOCK=0x0A7;

void read();
void main()
{
/* Set up UART */
T3CON = 0x082;
T3FD = 0x02D;
SCON   = 0x052;

/* PRECONFIGURE...*/
RESET=0;//reset AD7783
RESET=1;
SCLOCK=1;
DOUT=1;
CS=1;
DRDY=1;
printf("\n");
CS=0;
read();
CS=1;
}

/* subroutines*/

void read()  //The subroutine read 200 data from the data register
{
 unsigned char temp1;
int i,j;
temp1=0x00;
for(i=0;i<200;i++)
	{while(DRDY);
        for(j=0;j<24;j++)
     	{SCLOCK=0;
	 SCLOCK=1;
     	 if(DOUT==0)
     	 temp1=temp1<<1;
	 else
	 {temp1=temp1<<1;
	 temp1=temp1+0x01;}
         if(j==7||j==15||j==23)
          { printf("%02BX",temp1);
           temp1=0x00;
           }
          }
          printf("\n");
      	}
	printf("\n\n\n");

}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -