There are many codes for ADC online, but can some one suggest me one which helps me understand the Analog to Digital conversion apart from temperature sensor code. Suggest a video that can explain the code
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.
There are many codes for ADC online, but can some one suggest me one which helps me understand the Analog to Digital conversion apart from temperature sensor code. Suggest a video that can explain the code
Yes, if you go on the product website of the MSP430FR5969, you can download a .zip-file containing lots of code examples for all the different modules of the processor. There is a .txt-file included in it, giving you an ovierview of the different programs.
Dennis
There is no specific ADC example program for measuring a sine wave. The ADC does not care about the signal you feed in. It takes one sample after the other. But to successfully reconstruct it, you have to take care of the Nyquist-Shannon-Theorem:
f_sample has to be at least twice f_signal
And keep in mind that your sine wave has to be all positive - it might need an offset. The ADC cannot measure negative voltages.
What "waveform" do you mean? You have to feed in your signal into A1 at pin 1.1 (48 bit RGZ package). If you're using the LaunchPad, then this signal is not routed to the headers, I think. In that case, use another analog channel like A2, A3, A4, A5, A7, A10, A11 or A12.
Dennis
A "digital sampled sine wave in the second channel"? If you want to measure it with an oscilloscope, then you will have to feed it back into a DAC since an oscilloscope measures voltage. This can be a DAC module/IC or a PWM modulated signal with a low pass filter.
Or you output the digital values to a terminal program. The question is: What do you want to do with the sampled signal?
Yashaswy Akella said:where do I need to connect it on the board?
Dennis Eichmann said:You have to feed in your signal into A1 at pin 1.1 (48 bit RGZ package). If you're using the LaunchPad, then this signal is not routed to the headers, I think. In that case, use another analog channel like A2, A3, A4, A5, A7, A10, A11 or A12.
Yashaswy Akella said:where do I connect it on board in order to see it?
Dennis Eichmann said:If you want to measure it with an oscilloscope, then you will have to feed it back into a DAC since an oscilloscope measures voltage. This can be a DAC module/IC or a PWM modulated signal with a low pass filter.
Yashaswy,
in which form do you expect the data to come out of the microcontroller? When you do not want to use some sort of DAC, then your output pins can go high, or low, nothing else - they are digital. The sampled value is a number according to the relation of it's voltage and the ADC's reference voltage. And this number is represented by a sequence of 0s and 1s. You could now output them to the ports, having your number given to the pins in parallel, but this nothing you can probe with your second channel. You could use a R2R-DAC that is driven by the parallel output of the value and connect this to the second channel.
Otherwise you can output the data over the UART (I think, I mentioned this before) or you could also use a PWM that represents your input value. This could be measured by the second channel, as well.
Dennis
Yashaswy Akella said:I'm not able to get what you explained in the diagram and also modify the code according for the sine wave. Please help man! I've been struck on this for more than a week now
Yashaswy,
then please show us what you have done so far. Let's work on your source code to get it running.
Dennis
Because sine is a basic signal, I want to try it. It has a DC offset of 1V and amplitude 1V peak-to-peak with a frequency of 1Hz
Well the question is: What do you want to do with your sampled signal? Do you want to store it or immediately output the measured value again? If you want to store it, then you will need an array that will be filled with your measured values. The size of it depends on the frequency of your input signal and the length of the time you want to record it. To be honest: I still do not know what you are planning to do. I remember there was something with outputting it for feeding it back into the second channel of your oscilloscope where we already made some suggestions (hope I do not mix things up now).
Okay, the thing is I did not know how the digital signal works so I wanted to see it in second channel- which is wrong.
Now that I've read the basics, I want to see the digital values in the ADC variable in variable window of CC studio of the input sine wave (1Hz, 1Vpk-pk, 1V dc offset ) for which I need a code that can help me get that.
Also, not about storing values. I'll just make a note of them, try plotting those values in Excel and see the digital sine wave
What will the reference voltage be? is it Vcc which is 5V?
and how did you know to check the ADC12MEM0?
Yashaswy Akella said:msp430fr59xx_adc12_01.c
I looked at your example code. The configuration of the ADC12 determines the used reference voltage. In the given example, Vref is AVcc.
What does configuration of ADC mean? Does it vary for every code or for every controller?
I then tried msp430fr59xx_adc12_11.c ADC12, Sample A2, T0A1 Trig, Ultra-Low Pwr
which I take input from A2. Am I right. Can I give it a sine input and which registers show me the output?
Yashaswy,
it seems if you have not really an idea of what you are doing, which is no problem in general - everyone has started this way. But I think you should go some steps back and first try to understand the basic working principles of the microcontroller. Maybe starting with the "Hello World" example in form of a blinking LED wouldn't be a bad idea. You will not find an example that will match exactly your requirements, so simply trying all of the examples, hoping one will be sufficient for your specific task, will probably not work. Furthermore it is very difficult to prove your results when you do not know what your program is doing. Reading the ADC with a fixed sampling interval and stream the data to the PC might be too much for the moment.
Please don't get my intention wrong now - there is no problem with having no idea about it, but then you simply have to learn it by doing one step after the other. Someone could now simply throw those few lines together, but what do you learn from it? I think, at this point, the task you want to handle is way over your experience level.
This might now sound disappointing to you, but I think the lack of knowledge is too large for this project. Do yourself a favour and start with a smaller project. You will get all the help you need with it, but for the current project you want to achieve, someone would have to explain completely everything to you and this might be too much information. You will have to understand the basics first. For the ADC, for example, reading the user's guide's chapter for this module would have answered you the possible reference sources and the registers which define the used source. The user's guide is a massive document, but the single chapters are quite small. You will have to invest some time into it.
Dennis
**Attention** This is a public forum