Quantcast
Channel: Microcontrollers
Viewing all articles
Browse latest Browse all 224600

Forum Post: MSP-EXP432P401R: How Analog Channels Map to Pins in MSP432 launchpad

$
0
0
Part Number: MSP-EXP432P401R I am using an MSP432 launchpad to control and read from a linear CCD, then send the values over a serial USB connection. I found this code on the forum at https://e2e.ti.com/support/microcontrollers/msp430/f/166/t/531322#pi316701=3 and modified it to focus on my needs and questions. //Clock_Signal is a 100 kHz external clock that is read by a digital I/O pin uint16_ Data[2048]; P9SEL1 |= BIT1; P9SEL0 |= BIT1; // Set pin 9.0 to tertiary module function (analog input?) ADC14CTL0 &= ~ADC14ENC; // Turn off enable to modify bits. ADC14CTL0 |= ADC14ON | ADC14SHP | ADC14CONSEQ_2 | ADC14MSC | ADC14SHT04; // Turn on ADC14, set sample and hold, repeat single channel, convert continuously, and sample-and-hold for 64 clocks ADC14CTL1 |= ADC14RES__14BIT; // Set resolution to 14-bits ADC14MCTL0 |= ADC14VRSEL_0 | ADC14INCH_14; // A0 ADC input select; Vref=AVCC=3.3V ADC14CTL0 |= ADC14ENC | ADC14SC; // Enable ADC14 and start first conversion // Read one value during each up cycle of the clock until 2048 values are read for(int i=0; i<2048; i++){ while(Clock_Signal=0); // Wait until the up cycle of the clock begins (100kHz) Data[i] = ADC14MEM0; // Store the most recent conversion result while(Clock_Signal=1); // Wait until the end of this clock's up cycle } // Or alternatively, attach an interrupt to the Clock_Signal rising edge void Clock_Signal_ISR(){ if (index < 2048){ // index will be reset to 0 when a new scan begins Data[index] = ADC14MEM0; // Store the most recent conversion result index += 1; } } What are the primary, secondary, and tertiary module functions? Is the tertiary module function an analog input? Have I properly configured P9.0 to be an analog input? Is setting ADC14MSC all I need to set the ADC14 into free-running mode (continuously converting)? Does this mode reduce the life of the ADC14, or have any other drawbacks besides more power consumption? Can the ADC14 be triggered to start a conversion based on an external signal? I am only running it continuously because it looked like the only options were triggering off of internal counters or through software. In that case, continuous conversions seem like a more fail-safe approach. How do I set the input in register ACD14MCTL0 to be pin P9.0 on the launchpad? How does this pin correlate to A0, A1, etc.? I couldn't find anything in the technical reference. What is the advantage to sampling and holding for more clock cycles? Specifically, does the time-constant of the sample-and-hold circuit change to match the sample time, or do the gains of sampling longer diminish due to a fixed fast time-constant? The interrupt service routine seems cleaner and more best-practice, but I've had trouble using interrupts together with Serial USB communication before. This trouble was on an Arduino DUE, and I don't know if the same problems apply here. If my clock signal is continuous, it will be triggering interrupts during any serial transmissions, which caused the problem before. Would I need to detach this interrupt before I send Serial (then re-attach it later)? Thanks to anyone for your input!

Viewing all articles
Browse latest Browse all 224600

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>