MSP430, sigma-delta AD

Dear All,

Running on TI MSP430, a sigma-delta AD design, read a signal from UART RX, do SD AD, and then output to UART TX.

Setup: UART is 9620 baudrate.

1 bit Sigma-delta AD. Switched-capacitor input. load capacitor 14pF ( need to change? ) 1.2V reference voltage ( provided by internal )

Here is partial code: ///////////////////////////////////// ... unsigned int RXTXData,results; ....

while (1) { RX_Ready(); // UART ready to RX one Byte _BIS_SR(CPUOFF + GIE); // Enter LPM0 Until character RXed

SD16CCTL0 |= SD16SC; // Set bit to start conversion while ((SD16CCTL0 & SD16IFG)==0); // Poll interrupt flag results = SD16MEM0; // Save CH0 results (clears IFG) _NOP();

if (results >32767) { results=results-32767; RXTXData=results/26.214; } if (results == 32767) { RXTXData=0; } if (results

Reply to
Boki
Loading thread data ...

"Boki" ???????: snipped-for-privacy@j72g2000cwa.googlegroups.com...

Doing shift ? due to unsigned ?

Reply to
Boki

I very much doubt it -- it just looks like the code after _NOP() just performs scaling.

Because apparently the input device connected to your A/D produces voltages that are supposed to be interpreted as 1250 down to 0 (1250=32768/26.214) as the input voltage rises from 0 to half the A/D's reference voltage, and then 0 to 1250 as it ranges from half the reference up to the reference. This assumes the ADC produces codes from 0-65535 as the input voltages rises from 0 to the reference voltage; this is not at all true on some ADCs, so should be checked in the part's data sheet.

The test for "results == 32767" appears unnecessary if you change the first "if" statement to include "if (results >= 32767) ..."

What is the A/D converter input connected to?

---Joel Kolstad

Reply to
Joel Kolstad

The sequence of ifs looks very odd to me. I would understand it better if the last two were else ifs.

Assuming that they means else ifs, which is a big assumption, this seems to be code that gets absolute value of deviation of SD16MEM0 from 32768, normalized to whatever by dividing by 26.214.

i

Reply to
Ignoramus24108

Joel Kolstad =E5=AF=AB=E9=81=93=EF=BC=9A

forms

es

4) as

hen 0

rom 0

be

first

Yes, you are right, "results =3D=3D 32767" is unnecessary.

It is a pulsation application, what I strange is the output will become a 'V' form...

0~32767: when RX higher, the output TX value becom lower. 32768~65535: when RX higher, the output becom higher.

Still can't understand why do this..

Best regards, Boki.

Reply to
Boki

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.