我使用ADS1232接2mv/v的称重传感器,使用通道2,增益128,速递10次每秒,关闭温度传感器功能,可读出来的数不管怎么按压传感器都不怎么变,这个传感器是没有问题的,在HX711芯片上用四线制测试吹气都能有变化。可在用六线的ADS1232上数值就不怎么变化了。希望大家给予指点。
下面的数值,不管怎么按压压力传感器都不怎么变化。
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
#include "ADS1232.H" #include "port.h"
/* sbit ADS1232_DOUT = P2^0; sbit ADS1232_SCLK = P2^1; sbit ADS1232_PWDN = P2^2; sbit ADS1232_SPEED = P2^3; sbit ADS1232_GAIN1 = P2^4; sbit ADS1232_GAIN0 = P2^5; sbit ADS1232_A0 = P2^6; sbit ADS1232_TEMP = P2^7; */
#define ADS1232_SCLK_HIGH do{ADS1232_SCLK=1;}while(0); #define ADS1232_SCLK_LOW do{ADS1232_SCLK=0;}while(0); #define ADS1232_PWDN_HIGH do{ADS1232_PWDN=1;}while(0); #define ADS1232_PWDN_LOW do{ADS1232_PWDN=0;}while(0); #define ADS1232_SPEED_HIGH do{ADS1232_SPEED=1;}while(0); #define ADS1232_SPEED_LOW do{ADS1232_SPEED=0;}while(0); #define ADS1232_GAIN1_HIGH do{ADS1232_GAIN1=1;}while(0); #define ADS1232_GAIN1_LOW do{ADS1232_GAIN1=0;}while(0); #define ADS1232_GAIN0_HIGH do{ADS1232_GAIN0=1;}while(0); #define ADS1232_GAIN0_LOW do{ADS1232_GAIN0=0;}while(0); #define ADS1232_A0_HIGH do{ADS1232_A0=1;}while(0); #define ADS1232_A0_LOW do{ADS1232_A0=0;}while(0); #define ADS1232_TEMP_HIGH do{ADS1232_TEMP=1;}while(0); #define ADS1232_TEMP_LOW do{ADS1232_TEMP=0;}while(0);
void ADS1232_init(unsigned char channel, unsigned char gain, unsigned char speed, unsigned char temp) { ADS1232_SCLK = 0; ADS1232_PWDN_LOW; if(channel==CHANNEL1) { ADS1232_A0_LOW; } else if(channel==CHANNEL2) { ADS1232_A0_HIGH; } if(GAIN_1==gain) { ADS1232_GAIN1_LOW; ADS1232_GAIN0_LOW; } else if(GAIN_2==gain) { ADS1232_GAIN1_LOW; ADS1232_GAIN0_HIGH; } else if(GAIN_64==gain) { ADS1232_GAIN1_HIGH; ADS1232_GAIN0_LOW; } else if(GAIN_128==gain) { ADS1232_GAIN1_HIGH; ADS1232_GAIN0_HIGH; } if(SPEED_10==speed) { ADS1232_SPEED_LOW; } else if(SPEED_80==speed) { ADS1232_SPEED_HIGH; } if(TEMP_ON==temp) { ADS1232_TEMP_HIGH; } else if(TEMP_OFF==temp) { ADS1232_TEMP_LOW; } ADS1232_PWDN_HIGH; }
char ADS1232_read_value(long int *value) { long int temp=0; unsigned char i=0; if(ADS1232_READY==ADS1232_DOUT) { ADS1232_SCLK_LOW; for(i=0; i<24; i++) { ADS1232_SCLK_HIGH; temp <<= 1; if(1==ADS1232_DOUT) { temp |= 0x01; } ADS1232_SCLK_LOW; } ADS1232_SCLK_HIGH; // The 25th SCLK to force DOUT high ADS1232_SCLK_LOW; if((temp&0x800000)==0x800000) { temp ^= 0Xffffff; temp = -(temp+1); } *value = temp; return ADS1232_READ_FINISH; } else { return ADS1232_BUSY; } }
驱动代码如下:
以前我做过一个ADS1234的板子,是用恩智浦的CORTEX-M0内核的LPC1114控制的,在淘宝有卖过哈,不过后来没再做这方面的事情...你要是需要等我回去把源码和电路给你参考一下
那谢谢你了,等我把称重这个调试稳定了,一定请你吃饭,加我QQ960546564,邮箱bjyibiao@126.com 或者留下您的联系方式
谢谢,我也需要一个ads1232的资料,最近在做压力检测,很是苦恼