Вт мар 19, 2019 01:34:50
Ср мар 20, 2019 22:53:02
#include <stdio.h>
#include "STC15F2K60S2.H"
#include "ADS1256.H"
#include "uart.h"
sbit LED = P5^5;
void DelayMs( unsigned int ms)
{
unsigned int i,j;
for (i = 0; i < ms; i++)
for(j=0;j<1074;j++);
}
#define u8 unsigned char
#define u16 unsigned short
// sbit SCK = P1^2;
// sbit DIN = P1^3;
// sbit DOUT = P1^4;
// sbit DRDY = P1^5;
// sbit CS = P1^6;
void main()
{
u16 ch=0;
signed long Adc;
float Volts;
char str[20];
InitCOM();
Init_ADS1256_GPIO();
DelayMs(50);
ADS1256_Init();
while(1)
{
for(ch = 0;ch < 8;ch++)
{
//Adc = ADS1256ReadData((u8)( 0| ADS1256_MUXN_AINCOM));
Adc = ADS1256ReadData( ch<<4|ADS1256_MUXN_AINCOM);
/*²î·Ö²É¼¯·½Ê½*/
/*Adc = ADS1256ReadData( ADS1256_MUXP_AIN0|ADS1256_MUXN_AIN1); //P = AIN0 ,N = AIN1 ²î·Ö·½Ê½*/
Volts = Adc*.00000059453; // 0.00000059453
sprintf(str,"ͨµÀ%d:%fV ",(u16)ch,Volts);
SendString(str);
}
SendString("\r\n");
DelayMs(10);
LED=!LED;
}
}