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.

MSP430F2013 AD16 Voffset

Other Parts Discussed in Thread: MSP430F2013

I get readings and the more i use this AD16 converter the more i think i may need to go to a different one. i choose it for the 16bit AD converter, but in reality it is a 13bit AD converter. This is my last attempt at using this chip. i found it before but i cannot find it agian an answer to this question in the forums.

the fact the MSP430F2013 has a 1.2Vref maximum, actually 1.5Vmax according to datasheet, would be fine if that was a FSR. but we have to divide that by 2. so now i got a ±0.6Vdc around ZERO. 

The problem with the TSSOP 14P MSP430F2013 is there is no AVss, which is what i would assume i would use to offset. i have tried to use the differential input characteristics thinking if i put 0.6V on A0- pin that would than consider that as ZERO so then when A0+ sees 0.6V it would register as a 0x8000. however this is not the case. 

Due to my earlier questions and getting use to this forum here is the code per requests from various engineers.

/* SD16 setup channel 0, single conversion, internal 1.2Vref, High speed buffer, no interrupts, 256 xOSR */

#define SD16BUF_HS (0x6000)  // Bits 14-13 of SD16CCTL0
#define SD16XDIV16 (0x0400)  // Bits 11-9 of SD16CTL

int SD16_init(void){
     SD16CTL = (SD16XDIV16 + SD16REFON);
     SD16CCTL0 = (SD16BUF_HS + SD16SNGL);
     return 1;
}

int SD16_read_ch0(void){
     SD16CCTL0 |= SD16SC;
     while(!(SD16CCTL0 & SD16IFG));
     return (SD16MEM0 >> 3);
}

When i run this code, even though i have zero volts on A0+ i read 0x8000 and i still have a maximum of 0.6V input rather than what i was hoping was 0-1.2V with 0.6V as the zero. is there a way to setup the converter to read 0.6V as the zero marker to get a range of 0-1.2V instead of 0-0.6V

Edit: I also tested to see if maybe the fact i am using an internal Vref is causing a shift, for example, maybe A0- is tied to AVss. so if i put A0- to 0.6Vdc than AVss is 0.6Vdc so it just shifted everything up. so i change the system to have an external Vref of 1.2V and removed the SD16REFON in the code. This however did nothing different.

Edit: I found the earlier articles. this one is exactly what i am trying to do.

SD16 of MSP430F2013 - Clamp Voltage Problem

but every time i try and post link it creates a big image.

someone pointed out i was reading wrong document so i checked and removed the SD16BUF_HS line since the MSP430F2013 does not have a high speed buffer input option.

I am going to replace the chip maybe i broke it in all my testing

  • This code is not applicable for this MCU. Also your expectations does not fit this AD converter, do I believe you didn’t read the correct Data Sheet and User’s Guide or User’s Guide Section.
  • i am 100% sure i am reading the right documents. if you feel that i am reading wrong documents can you please link the proper ones because the documents i read have MSP430F2013 all over them and i downloaded them from the TI website directly on the page for the MSP430F2013. TI document SLAU144J Revised July 2013. there may be an old link on the website but this is deffinately the doc for it.
  • The AD converter from this MCU gives an 16-bit result (actually even 30-bit) and not 13-bit.
    The converter has a Full-scale range (0000h – FFFFh) of 0-0.6V (Vid is 0-0.5V) with a Gain of 1 in Unipolar mode.
    The converter doesn’t have an Input buffer.
    This MCU have shared Port-pin functions, which means you need to select the correct function.
    Vref of this MCU is 1.2V not 1.5V.
  • the db noise level of 81dB takes the 16-bit value down to a 13bit value when using OSR256. and the remaing x bits in the lower range are all usless noise unless i want to do some software of hardware filtering, which i dont.

    yes i understand in uni mode it is 0-0.6Vdc i want ot alter that to 0-1.2Vdc, which is what my whole question is pertaining.

    i corrected the input buffer issue, but seeing as it doesnt have one the system probably ignored it. plus i removed it and it still did not work.

    i understand the shared port pins issue here is my IO setup

    int IO_init(void){
         P1SEL = 0xeb;
         P2SEL = 0x00;
    
         P1DIR = 0x74;
         P2DIR = 0x7f;
    
         return 1
    }

    vref is 1.2 typ and the internal reference is 1.2V but using an external Vref you can go up to 1.5Vdc max.

    none of which helps with the question at hand of does the differential input work as i expect and by setting a voltage reference of 0.6Vdc on the A0- pin i can measure the swing around that value ±Vref/2 with A0- set at 0.6Vdc and using the internal reference of 1.2V and a gain of 1 would mean i can measure 0V-1.2Vdc. or is this an impossibility 

  • dominic leone said:
    i understand the shared port pins issue here is my IO setup

    You are still in the wrong document/section, only the SD16AE bit selects this Port function.

    dominic leone said:
    does the differential input work as i expect and by setting a voltage reference of 0.6Vdc on the A0- pin i can measure the swing around that value ±Vref/2 with A0- set at 0.6Vdc and using the internal reference of 1.2V and a gain of 1 would mean i can measure 0V-1.2Vdc.

    This is what a Differential input supposed to do, so Yes.

  • thank you for the response and the information that my idea is correct. i hope i just blew out the chip during testing. and i have SD16AE= 0x01 to enable the SD16_A.

    Is there any other setting you can think of that would prevent the chip from giving the desired results. my PCB guy is putting on new chip now so i will know soon if that is problem.
  • As you experienced now the chip/inputs are sensitive, take good care of the input voltages.
    For a good result enable REFOUT and add the advised capacitor.
    For maximum performance, calculate the voltage divider so that the differential voltage stays within Vid.
  • It does not seem to care about my differential input. Even though i have 0.6Vdc on A0-. i get the same readin with A0- connected to 0.6Vdc as i do if A0- was connected to ground. it just changed my range and accuracy.

    when i have A0- connected to GND, i get 0bits -> 8192 bits of a range of 0V - 0.6Vdc. when i connect 0.6Vdc to A0-, i sense 0-0.6Vdc but now only using bits 4000 -> 8192bits.

    expected with a differential input with 0.6Vdc on the A0- input - 0-0.6Vdc => 0-4000bits and 0.6Vdc-1.2Vdc =>400-8000bits
    those are rough numbers. is there some bit that turns on the A0- so it looks for it as a differential. it seems like it ignores the A0- pin and uses an iunternal AVss reference to GND
  • dominic leone said:
    it seems like it ignores the A0- pin and uses an iunternal AVss reference to GND

    Then you don’t have enabled the A0- pin for Analogue input.

  • I was thinking that last night. is there something i have ot do to enable the A0- pin for analog input

    I use the line, A0- is P1.1 on this chip

    P1SEL= 0xe3;

    which sets the P1.1[A0-] pin and P1.0[A0+] as non general purpose I/O

    then i put the direction,

    P1DIR = 0x74;

    which sets both P1.0 and P1.1 as inputs

    finally i set 

    SD16AE = 0x01;

    is there some other setting i need? i also tried setting SD16AE = 0x11, thinking since A0- and A4+ share a pin i needed to turn that on also but that did not seem to do anything.

    i appreciate the help also. 

  • >i also tried setting SD16AE = 0x11
    Correct setting for A0+ and A0- is:
    SD16AE = 0x03; // note that those bits are representing ADC pins, not inputs
    Also Bipolar Offset Binary data representation mode will not hurt - when both SD16UNI and SD16DF is '0'.
  • Thanks. I misunderstood the document.

    I changed the SD16AE = 0x03; and now no matter what i get 0 from a SD16MEM0 read. if i change the SD16AE back to 0x01, i get my broke system of only the upper half reading which makes sense now after i re-read with the understanding AE is for pins not port, it is connecting A0- to Vss when not enabled.

    I did not understand your statement regarding SD16UNI and SD16DF. i have both of those set to '0'. i assume this is correct since UNI determines bipolar and DF determines offset. but i did try the 2's complement to see if that would make the system work but it too did not do anything.

    is there a setup for the pin i am missing again like with the SD16AE that would cause it to output values when SD16AE = 0x01 and only output '0' when SD16AE = 0x03?
  • Do you use Launchpad? If yes - then what about UART TX/RX and LED1 jumpers? Still in place?
  • I got it to work right now. i had tested voltage levels and everything yesterday. but because this is a PCB i have hacked up now one of my solder connections became loose. yesterday i had a solid 0.6VDC on A0- today though the resistor divider came disconnected during testing, or cleaning lady. after resoldering the connection, i got the desired results with your recommended SD16AE = 0x03.

    Thanks for all the help. and also to Leo

    On to USI communication to talk to a DAC.

**Attention** This is a public forum