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.

Programming MSP430 F1611 with various sensors

Other Parts Discussed in Thread: MSP430F1611

Hi, 

I am new to TI MSP430 and have no previous background on programming for microcontroller,

for my senior design project I am responsible for programming the MSP430 F1611 in C to record values from:

 

Freescale(MMA7361) - Accelerometer

Interlink A201 - Foot Force Sensor

Minisense 100 - Piezoelectric Sensor

 

and transfer the data onto external storage on a SD card. I haven't taken a class in programming a microcontroller and have no idea where to start.

 I have been searching online and have seen some code posted but I am having trouble understanding them. Can you guys give me some advice on how to approach this? Provide guidelines, point me to the right resources, or give examples on how to start coding for it?

Any help is greatly appreciated!

 

Thanks in advance.

 

 

  • Allen,

    Your sensors are analog and require the use of the MSP430's ADC. Do you already have the circuitry necessary to connect the sensors to the MSP430?

    The Accelerometer can likely connect directly to the ADC, but the Piezoelectric and force sensors likely require some circuitry, probably op amps to ensure that the low ADC impedance doesn't affect the measurements. It's best to consult application notes from the manufacturer and example designs for this.

    Once you have the circuits, using the ADC is not necessarily difficult. You will likely want to use a sequence of channels sampling to sample each channel onea fter the other.

    The best sources of information are the MSP430F1611's User's Guide:
    http://www.ti.com/litv/pdf/slau049f

     

    The Sample code is also very useful, look for the ADC examples.:
    http://www.ti.com/litv/zip/slac015n

     

    Gustavo

  • Allen,

     

    Given that you have no background in C programming, I recommend that you get some books:

    The C Programming Language

    http://www.amazon.com/Programming-Language-2nd-Brian-Kernighan/dp/0131103628/ref=sr_1_1?ie=UTF8&s=books&qid=1301800659&sr=8-1

     

    If the User's Guide and tutorials are not enough, there's also a book on the MSP430 (one of several available):

    http://www.amazon.com/MSP430-Microcontroller-Basics-John-Davies/dp/0750682760/ref=sr_1_1?s=books&ie=UTF8&qid=1301800679&sr=1-1

     

    Gustavo

  • For the SD card storage, you'll need the SPI interface of the 1611 USART module. There are several threads in this forum on how to access an SD card with SPI. You are limited, however, to cards below 2GB as the higher ones usually don't support the serial communications mode anymore (and the parallel one woudl require manual programming of the ports, resulting an a much slower transfer) and also have a different handling and require significantly larger buffers on the MSP side. (e.g. 2k instead of 512 bytes).

    Also., there are many threads about ADC12 programming.

  • Thanks for the fast response, the information is helpful but I am having trouble understanding the basics of ADC programming.

    This project is suppose to be a team effort and I believe that my teammates have sorted out the hardware circuitry including op-amps and capacitors to make it work.

    I am responsible for the programming and I was wondering if you could kindly show me where I can find more information on using the ADC, and how to the "sequence of channels sampling" to sample each channel. Perhaps provide an example code, or a brief tutorial to help get me started?

    Your help is truly appreciated,

     

    Allen

    Gustavo L said:

    Allen,

    Your sensors are analog and require the use of the MSP430's ADC. Do you already have the circuitry necessary to connect the sensors to the MSP430?

    The Accelerometer can likely connect directly to the ADC, but the Piezoelectric and force sensors likely require some circuitry, probably op amps to ensure that the low ADC impedance doesn't affect the measurements. It's best to consult application notes from the manufacturer and example designs for this.

    Once you have the circuits, using the ADC is not necessarily difficult. You will likely want to use a sequence of channels sampling to sample each channel onea fter the other.

    The best sources of information are the MSP430F1611's User's Guide:
    http://www.ti.com/litv/pdf/slau049f

     

    The Sample code is also very useful, look for the ADC examples.:
    http://www.ti.com/litv/zip/slac015n

     

    Gustavo

     

  • There are several threads in this forum dealing with the ADC12.

    Basically, the ADC12 can run sort of a script. Where you can define up to 16 sampling commands. (ADC12MCTLx) adn get up to 16 samplign results (ADC12MEMx).

    YOu program each command individually (which channel to use, which reference etc) and you can set a 'last command' flag.

    Then you tell the ADC12 to run the 'script' from 'command' x to the last command in the 'script'. YOu can specify afte rwhich conversion you want to get an interrupt (not necessarily the last), whether the sequence shall be executed once or continuously or just the first one (once or repeatedly).

    The more complex options allow controlling the timings (trigger each step by a timer or external source, vary the sample-and-hold times etc), define the conversion clock etc.

    That's the basics.

    The ADC12 itself uses successive approximation conversion. So it requires one approximation more than there are bits in the result. (13 conversion clock cycles for a 12 bit result). Before converting, it samples the input signal to a sampling buffer (an internal capacitor) then breaks the connection to the pin, so the voltage does not change during conversion. Minimum is 4 clock cycles if you don't use the direct control feature.
    Since the ADC has only one conversion logic but up to 16 inputs, it uses a multiplexer to switch to the next input if required. This is why it needs a sampling time right before the conversion even if there would be plenty of time while convertign a different channel. (as a positive side-effect, it makes the timing more uniform = independent of which combination of input channels you use).

    btw, it is perfectly valid to sample from the same input in different commands. E.g. if you want to calculate an average over several readings.

**Attention** This is a public forum