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.

msp430g2553 launch pad ADC conversion

Other Parts Discussed in Thread: MSP430G2553

Dear All,

I am trying to do an ADC conversion using msp430g2553 launch pad. I am using The code composer studio here. When I build the code , it is successfully executed. After the debugging and 'RUN', no value displayed in ADC10MEM register. When I stop the execution(RUN button stopped), the value is displayed.Why am I not getting the data in ADC10MEM while executing? How can I do a real time pulse wave conversion in msp430g2553? 

  • Ammassk,

    you mean the value in this window?

    This will be updated when the program is paused

    Imagine your ADC would do 1000 samples per second and you wanted do display the values in "real time" - what do you expect to see there?

    Dennis

  • Then how can I see each sample conversion?
  • This depends on the speed of your conversions. If you haven't very many conversion results per second you can somehow output them over the UART to the PC immediately. Or (for debugging purposes) you can collect them in an array and have a look at them after some time, but this depends of your number of conversions per time as well because this array might need to be very large in size. Or place your cursor at the point where the result is available and press Ctrl-R for running to this line. The debugger will then always pause the program at the position of your cursor where you then can see the result, but this is no normal program flow in that case. You only have your program running for a very short time, then pause, then running, then pause, ... It depends on what you are doing.

    Dennis
  • The method which Dennis suggested is the most practical way, I just want to add one nice feature about this. If you have your conversion results in an array, you can easily show the results as graph by using CCS. Just click on Tools -> Graph -> Single Time and enter the array location and size there.

    Best regards,
    Tobias
  • input signal having frequency 0.5hz-10 hz.It is continously coming to INCH_5. To do the conversion and see the value, how can I code?I select 1 MHz SMCLK ,CONSEQ_2. In this case how can I set the sampling and conversion time?
  • Did not know that feature yet - thanks for pointing to it. I will give this a try as well.

    Dennis
  • Ammassk,

    10 Hz isn't very much, so you could easily output them over the application UART while measuring. At 9600 baud with 8N1 format you can (in theory) output 9600 / 10 = 960 bytes/s. Since your ADC needs two bytes, this value is halved to 480 values per second. But this would be very cryptical since you get two single bytes, each represening a portion of the result. For example, having an ADC10 result of 762 would lead to 0x02 0xFA or in decimal 2 and 250, so unreadable without re-conversion to a real number. So you normally would convert the values to ASCII before sending them. This would be 4 bytes for each sample plus one or two control bytes for a new line gives you 960 bytes/s / 6 = 160 complete 4 digit outputs plus control bytes per second in your terminal program.

    But this needs two modules to deal with now - the ADC10 and the USCI in UART mode. For both there are programming examples by TI which can be downloaded here. Start with those - take only the ADC10 or the USCI for the moment until you know how they work. Then you can combine them.

    Or take the array method, but the G2553 has only 512 bytes of RAM, so not that much. At 10 Hz sampling (is it 10 samples per second or a 10 Hz signal like a sinewave - if it is the second case, then 10 Hz sampling isn't enough!), you will have 20 data bytes per second, so 512 bytes can hold 25 seconds of data (again in theory), but in real life you can only use a small portion of this memory. I would go for the UART method.

    But don't try to do too much at the same time. Start in steps, look at the code examples and read the chapters for the modules in the user's guide.

    Dennis

  • which clock I should select here. VLO can do this conversion of 10Hz signal?
  • The VLO cannot directly be chosen to source the ADC10 module. You might source ACLK from VLO and the ADC10 from ACLK, but I would simply start with the ADC's default ADC10OSC.

    Dennis
  • You can’t source the ADC with the VLO. The minimum clock frequency for the ADC is 450KHz, but preferable ~1MHz.
  • Ah yeah, thanks Leo, it is 450kHz minimum, that's right.

**Attention** This is a public forum