Discussion in "8051 Discussion Forum" started by    currumblera    Jan 13, 2008.
Fri Jan 18 2008, 01:54 am
#11
I have another problem AJAY....

1. Is this configuration correct? i have connected a load
cell, to analog port.
- AIN0 --> Output + from load cell.
- AIN1 --> Output - from load cell.
- Load cell supply --> +5VDC, GND.
- REFIN+ --> +5VDC
- REFIN- --> GND
- AIN2 to AIN7, REFOUT, and AINCOM, no connect.
- Whit a power supply of +5VDC i get in AIN0-AIN1, 0-10mV

2. i have tried with A2D code sample, you can see below (and with all of the other
programs with AD, from TI and KEIL).
It´s an easy program, and As you can see, I tried several
configurations. I have adapted the ADMUX=0x01,ADCON0=0x00,and ADCON1
= 0x01, for my configuration. You can see below. The result it´s the
same, a quiet value always (if it isn´t 0).

3. I have measure REFIN+/-, OUT +/- from load cell,... in circuit and
it´s OK.

4. Besides, I had connecting AINCOM to GND, REFOUT to REFIN+, and
REFIN- to GND, and a variable voltage to AIN0. No result!!

5. Finally, I tried the sample code from TI (precision on chip
temperature (ADMUX=0xFF)). No result!!

I am desperate. I contacted with the technical support TI (victor
prices) in spain, but took in reply!. I hope I can fix it, it´s an
important proyect.

I hope your reply, Ajay, best regards.


this is my code:

Main(void) {
char i,j;
float result;

PDCON = 0x75; // Turn on the A/D
ACLK = XTAL/1000000; // ACLK freq. = XTAL Freq./(ACLK +1) =
0.9216 MHz
// 0.9216 Mhz/64 = 14,400 Hz
DECIMATION = 1440; // Data Rate = 14,400/1,440 = 10 Hz
// ADMUX = 0x08; // AINP = AIN0, AINN = AINCOM
ADMUX = 0x01; // AINP = AIN0, AINN = AIN1
// ADMUX = 0x76; // AINP = AIN7, AINN = AIN6
// ADCON0 = 0x30; // Vref On, 2.5V, Buffer Off, PGA=1
ADCON0 = 0x00; // Vref Off, 2.5V, Buffer Off, PGA=1

CKCON = 0x10; // MSC1200 Timer1 div 4
TCON = 0; // MSC1200 Stop TR1
autobaud();
ADCON1 = 0x01; // bipolar, auto, self calibration,
offset, gain
// ADCON1 = 0x41; // unipolar, auto, self calibration,
offset, gain
// ADCON1 = 0x40; // unipolar, auto, no calibration,
offset, gain
printf("ADC Test, ACLK=%d\n",ACLK);
//wait for the calibration to take place
for (i=0;i<5;i++){ // dump 3 conversions
while(!(AIE&0x20)) {}
j=ADRESL;
}

j=1;
while(1){
while(!(AIE&0x20)) {} // Waiting for conversion
result=bipolar(); // Save Results
printf ("%10.8f\t", result*LSB);
if (!(j++%5)) printf("\n"); // Print 2 lines each second
}
}

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

KevinTab
Sun Apr 28 2024, 05:35 am
Tumergix
Sun Apr 28 2024, 12:59 am
StevenDrulk
Sat Apr 27 2024, 08:47 pm
StephenHauct
Sat Apr 27 2024, 09:38 am
Adamsaf
Sat Apr 27 2024, 07:12 am
Robertphype
Sat Apr 27 2024, 12:23 am
ktaletrryp
Fri Apr 26 2024, 10:55 pm
Robertrip
Fri Apr 26 2024, 11:20 am