cancel
Showing results for
Did you mean:

# dac & adc with stm32cubemx and keil

Associate III

I have a project using nucleo stm32f334.
With the way it works
I get the adc value from the 12 bit potentiometer. Then I want to display the value using dac and see the frequency, period and voltage from the oscilloscope.
I want the magnitude of the frequency of 200 hz with the period as fast as possible. I have used the formula to find the frequency, namely
f = CLOCK SOURCE / ((prescaler + 1) x (period + 1)) but the frequency produced by the oscilloscope is not 200 hz but between 35-40 hz.
I want to ask, are there other factors that I should calculate, or is there any influence from the clock configuration on stm32cubeMX?
Please help me, I really need your direction and help. Does anyone have a sample program or can anyone explain how I do it so that I don't get lost working on it? Thank you.

5 REPLIES 5
Evangelist III

@meriarajagukguk wrote:

I get the adc value from the 12 bit potentiometer. Then I want to display the value using dac and see the frequency, period and voltage from the oscilloscope.

This doesn't really make sense - what do you mean by frequency & period of a potentiometer?

Associate III

okay let me explain again yes I have a project to create a company's goods QC.
I don't know for sure what the stages are because I'm still a beginner. So I learned to use nucleo stm32f334.
The first step I did was to find the adc value from the potentiometer and use the dac to output a sine signal. well I was given a range for the frequency used is 200 hz.
But with the formula f = clock source / ((prescaler + 1) x (period + 1)) the frequency produced on the oscilloscope is in the range of 35-40 hz. Not according to what I want even though I have used the equation above. With stm32f334 is there any input to get 200hz results??
I also want to ask if my steps are correct? And I want to ask if I want to use the ADC value for the DAC is there a tutorial or simple example for my project.
I'm a beginner and honestly I'm also confused.

Evangelist III

@meriarajagukguk wrote:

I have a project to create a company's goods QC ...  I'm still a beginner.

This company is relying on a novice for their Quality Control system?!

@meriarajagukguk wrote:

The first step I did was to find the adc value from the potentiometer and use the dac to output a sine signal.

So the value read from the potentiometer is supposed to set the frequency of the sinewave output from the DAC?

Evangelist III

Why is there suddenly all this interest in generating sinewaves?

Associate III

halo can anyone help me guys?

this was just for a research assignment and I was told to study to develop a QC system but there was no mentor.
I was told to study using the Nucleo F334 because there are many parameters that are measured by the system, including measuring the speed of the tool and it is assumed to use a potentiometer. so I need several other factors besides potentio but now I focus on potentio. Therefore, if you want to give me input, I will be happy to accept it. my question:
1. I already have an adc value and want to use it to the dac but I'm confused about what function can be called if I store the value in 'adc_buffer'.
2. I want the results from the dac 200hz, but when I set it using this formula f=F_CLK / ((Prescaler+1)×(Period+1)) the result is only 40hz I use nucleo stm32f334r8
3. If I want to set the prescaler and period values, do I focus on the DAC with random values ​​first or do I set the prescaler and period values ​​after the DAC has successfully called the ADC value? ask for help.