Hi,
My name is Joshua. My friends and I are working on a project on MSP430FG4618. Our project is to basically to interface a very minimal range load cell with the MSP430.We are half way through in finishing the project but we are stuck in a stage where we are not able to frame a ADC program for this chip and also we are not able to find out the input pins on this MSP430FG4618. On going through the user guide manual we got to know that the input pins are in H8 or H9 slots of the MSP chip. So im thinking of connecting a 1v input from a regulator through a resistor pot onto the pin P6.0 and 9th pin of JTAG1 (as it is the GND pin for the negev wire) but this procedure can be done once we get the ADC program.
I have now explained at what stage my project is in. I would like if someone could help me with an ADC program for my chip and let me know if what ever I am trying to do is right. This is my college project so i need your help very badly. So kindly help me with this project asap.
thanking you,
Joshua
The pins are simple to find. Analog input voltages for ADC can be applied to the pins with A=-A7 and A12-A15 funcitonality.
These are the pins B1 (A3), B2 (A4), C2 (A5) C1 (A6), C3 (A7), F1(A12), F2 (A13), E5 (A14), G1 (A15), A4 (A0), D5 (A1) and B4 (A2).
How do you come to H8 and H9? H9 is P4.0 or USART TX, not an analog input pin. And H8 is NC.That is, if we are talking about the same 113pin BGA case (ZQW).P6.0, or A0, is on A4 slot. And what do you mean with "9th pin of JTAG1"?
They accept an analog voltage of 0V to the MSPs (A)VCC, relative to the MSPs (A)VSS. (AVCC and DVCC must be no more than 0.2V from DVCC and DVSS)For use with the internal precision references, 1.5V or 2.5V are the maximum.
About how to use the ADC12, there are several threads in this forum which explain how to use it. And of course teh 4x family users guide will tell you the internals of the ADC12 module.
Keep in mind that the complete documentation of every MSP chip consists of the device data sheet, the device errata sheet and the device families users guide. All three are available from the individual processors product page. And all three are mandatory.
_____________________________________Before posting bug reports or ask for help, do at least quick scan over this article. It applies to any kind of problem reporting. On any forum. And/or look here.If you cannot discuss your problem in the public, feel free to start a private conversation: click on my name and then 'start conversation'. But please do so only if you really cannot do it in a public thread, as I usually read all threads. And I prefer to answer where others can profit from it (or contribute to it) too.
Thank you for the reply sir. but some of the literature informs us that the P6.0 is used as an analog input pin for adc. and the pin p6.0 was found in the slot H8, thats how we concluded that pin P6.0 is the input pin. our guide informed us to apply an analog 1k ohm pot to the microcontroller so we applied the positive terminal to the pin P6.0 and the other terminal to the 9th terminal of the JTAG1 as it being denoted as ground pin for the microcontroller.
Can you please provide the code if possible for the conversion of the analog input to the digital output using adc and display on the lcd.
awaiting for the reply at utmost urgency.
thanking you
ROHIT JOSHUAsome of the literature informs us that the P6.0 is used as an analog input pin for adc.
ROHIT JOSHUAand the pin p6.0 was found in the slot H8
P6.0/A0/OA0I0 95 A4 I/OGeneral-purpose digital I/O / analog input a0—12-bit ADC / OA0 input multiplexer on + terminal and − terminal
So P6.0 is on A4, not H8. H8 appears nowhere on the terminal funcitons map and is probably one of the 13 pins the 113pin BGA has more than the 100pin TQFP case.
So where did you get this H8 from?
ROHIT JOSHUA the 9th terminal of the JTAG1 as it being denoted as ground pin
Jens-Michael Gross ROHIT JOSHUAsome of the literature informs us that the P6.0 is used as an analog input pin for adc.Right. ROHIT JOSHUAand the pin p6.0 was found in the slot H8Hmmm, well, from my version of the FG4618 datasheet P6.0/A0/OA0I0 95 A4 I/OGeneral-purpose digital I/O / analog input a0—12-bit ADC / OA0 input multiplexer on + terminal and − terminal So P6.0 is on A4, not H8. H8 appears nowhere on the terminal funcitons map and is probably one of the 13 pins the 113pin BGA has more than the 100pin TQFP case. So where did you get this H8 from? ROHIT JOSHUA the 9th terminal of the JTAG1 as it being denoted as ground pinOkay, that's what you meant. However, I'd suggest putting the negative terminal to A3, which is AVSS, to avoid adding any supply noise or GND current to the signal. Also, AVss and DVSS shouldn't be just tied together. Route them separately to the supply (pin9 of the JTAG, if that is your power supply)
Sir,
I am trying to connect a sensor to the analog input of the controller to the P6.0 pin i.e., A0 of the analog input on the MSP430FG4618/F2013 Experimenter’s Board.The A4 that you are mentioning is the pin number of P6.0/A0 for the PLASTIC 113-BALL BGA(ZQW) package. On the MSP430FG4618/F2013 Experimenter’s Board it is in PLASTIC 100-PIN TQFP (PZ) package. As mentioned in the evb user's guide the only headers on the experimenters board H1 to H9 and P6.0/A0 (Pin 95) is connected to the first pin of header H8. There is no A4 mentioned at all.
I want to know how the analog input can be connected and where to connect the GND on the board. Also I want to know the use of pin7(VREF+) on PZ which is mentioned as 'Output of positive terminal of the reference voltage in the ADC'
Kindly help me in sorting this issue.Thank you
Srinivasa SumanP6.0/A0 (Pin 95) is connected to the first pin of header H8.
I had no idea that it meant the header H8 of the experimenters board. And PIN 1 of this H8 header (which apparently has more than one pin then)
Sorry for the confusion.
On teh experimenters board, P6.0 is indeed on connector H8.1. However, it is also connected directly to the microphone circuit, as are P6.1 and P6.2. P6.3, P6.4 and P6.7 are connected to the Sallen-key 2nd order OA1 active LPF, and P6.5 (as OA2O) is connected to theaudio output jack. Apparently, P6.6 (A6) is the only input on P6/header H8 that is not directly connected to other circuitry and can be used for extenal analog input.
Alternatively, P5.0, P10.6 and P10.7 (A13-A15) On H9 can be used. (P5.1 is connected to the LED but with a jumper JP3).
H9 also bears the connectors for Veref+/-
thank you once again sir!!!!! can u please help us with the code??? we r struggling with dat!!! only if we get the code we can simulate the pins through IAR software.
Thank you sir for clearing my confusion on the availability of A0 on the experimenters board.Also, sir could please tell me the use of pin 7 (Vref+) which is mentioned as 'Output of positive terminal of the reference voltage in the ADC'. I want to know if it can be used as a power source for my sensor signal conditioning circuit.
ADC code in attached file
Srinivasa Sumancould please tell me the use of pin 7 (Vref+)
It should not be used to power anything, except if the maximum current draw is very, very low. You should use a voltage follower (OpAmp with gain=1) if you want it for driving something.
About your code: you need to configure ADC12MCTL0. Else it refers to the default setting: A0 input, VCC as reference. It is a good thing to configure it anyway, even with the vlaues which are the default, as it shows your intention. And you don't forget to change it if your intentions change :)For the same reason, you should set ADC12CONSEQ_0, ADC12CSTARTADD_0 etc. in ADC12CTL1 and ADC12IE0 instead of 0x01 for ADC12IE.Note that the use of ADC12MEM0 is independent of the use of A0 input.
I don't see any obvious bug in the code. (doesn't mean there is none :) )
However, A0 is conencted to the microphone hardware on the board, so any voltage you want to feed in there
//******************************************************************************// MSP430xG461x Demo - ADC12, Sample A0, Set P5.1 if A0 > 0.5*AVcc//// Description: A single sample is made on A0 with reference to AVcc.// Software sets ADC12SC to start sample and conversion - ADC12SC// automatically cleared at EOC. ADC12 internal oscillator times sample (16x)// and conversion. In Mainloop MSP430 waits in LPM0 to save power until ADC12// conversion complete, ADC12_ISR will force exit from LPM0 in Mainloop on// reti. If A0 > 0.5*AVcc, P5.1 set, else reset.// ACLK = 32kHz, MCLK = SMCLK = default DCO 1048576Hz, ADC12CLK = ADC12OSC//// MSP430xG461x// -----------------// /|\| XIN|-// | | | 32kHz// --|RST XOUT|-// | |// Vin -->|P6.0/A0 P5.1|--> LED//// A. Dannenberg/ M. Mitchell// Texas Instruments Inc.// October 2006// Built with CCE Version: 3.2.0 and IAR Embedded Workbench Version: 3.41A//******************************************************************************#include "msp430xG46x.h"
void main(void){ WDTCTL = WDTPW + WDTHOLD; // Stop WDT ADC12CTL0 = SHT0_2 + ADC12ON; // Sampling time, ADC12 on ADC12CTL1 = SHP; // Use sampling timer ADC12IE = 0x01; // Enable interrupt ADC12CTL0 |= ENC; P6SEL |= 0x01; // P6.0 ADC option select P5DIR |= 0x02; // P5.1 output
while (1) { ADC12CTL0 |= ADC12SC; // Start sampling/conversion __bis_SR_register(LPM0_bits + GIE); // LPM0, ADC12_ISR will force exit }}
#pragma vector = ADC12_VECTOR__interrupt void ADC12_ISR(void){ if (ADC12MEM0 >= 0x7ff) // ADC12MEM = A0 > 0.5AVcc? P5OUT |= 0x02; // P5.1 = 1 else P5OUT &= ~0x02; // P5.1 = 0
__bic_SR_register_on_exit(LPM0_bits); // Exit LPM0}
ROHIT JOSHUAWhether our prediction for P6.0
This is why I suggested using P5.1/A12 (after pulling J3 and disablign the LED4 attached to it) or P5.0 (apparently not connected to any on-board hardware). Both are accessible on header H9.
The GND, however, is taken wrong. The pin you marked is H7.1, which is connected to P3.0
Possible points for GND are JTAG1 (the header below the one you marked), pin 9, or from the breadboard area below the microphone, on the lower right side next to the board border (marked with "-"). The other side of the breadboard (marked with '+') carries VCC, in case you need it.
About the software, well, doesn't look wrong. (I see, you're using P5.1/LED3 for signalling. SO eithe ryou mcoe to a different LED, or you cannto use it as alternative analog input as suggested above).However, I'm no online-code-validator. Try it and see what's happened. And if it doesn't seem to work, tell us what you expected and what you observed instead.
Note, if changing the input from A0 to something else, you only need to write the change to ADC12MCTL0 (which is currently left to the default, which is A0 for all ADC12MEMx registers). No need to change from ADC12MEM0 to something different.
huuuurrrrraaaaaahhhhhh sir!!!! :)
we have found the input pin n the gnd as per u've informed us!!! :) Thank God n Thank you sir!!! :)
now that we know, the positive pin and the negative pin of the load cell are to be fed to the input pin P5.1 and to Gnd on the bread board respectively!!
our next hurdle is to display the amount of variation in the voltage when a component is placed on the load cell. so I think we need a program which reads the memory which contains the voltage varaition value from the load cell n displays it on the LCD.
my doubt is whether ADC12MEM0 is the memory where the value will be stored or is it something else???
sir can u please send the program asap!!!!! u have helped us alot!!! Thank you once again!!! God be wid u!! :)
ROHIT JOSHUAmy doubt is whether ADC12MEM0 is the memory where the value will be stored or is it something else???
You can see at the ADC12MCTLx registers as a script. Each ADC12MCTLx is a conversion command in this script. It contains the info which analog input is to be sampled, which reference is to be used and whether it is the last instruciton of the 'script'.Each conversion result will appear in teh ADC12MEMx register that is associated to the ADC12MCTLx register that controlled the conversion.
In the main config registers you say whether you want to exdcute a single 'line' of this script (single conversion), a single line over and over again( repeated single conversion), a full script run beginning with a specific 'line' until the 'end of sequence' tag is discovered (sequence of conversions) or running the script over and over again (repeated sequence). However, if using the repeated mdoes (single or sequence) the content of ADC12MEMx is overwritten with each 'run'. So you'll have to read and save it by software, according to your needs. The ADC12IFGx bits tell you when a new value has arrived in a specific ADC12MEMx register. And if you set the ADC12IE bit for the (last, in case of a sequence) ADC12MEMx of interest, you'll get an interrupt if this specific conversion has produced a new result (and in case of a sequence, all previous ones too)
ROHIT JOSHUAsir can u please send the program asap