Dear All,
Nice meeting you.
I'm new to Flowcode and finding it very interesting. Please, assist me with some clue on a flowchart to output sine wave.
Thanks.
Sine Wave
-
- Posts: 2
- Joined: Thu Oct 15, 2009 1:26 pm
- Contact:
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Sine Wave
Hello Astrea
How are you outputting the analogue value eg. Is it using a DAC device or using a PWM etc?
Does the Sine wave have to go negative or is it ok if it is shifted so that the min is 0v and the max is 5v so that the mid way is 2.5V?
How are you outputting the analogue value eg. Is it using a DAC device or using a PWM etc?
Does the Sine wave have to go negative or is it ok if it is shifted so that the min is 0v and the max is 5v so that the mid way is 2.5V?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Sine Wave
If it was me, i would use a variable duty PWM, feeding into a resistor and electrolytic cap. That will produce 0 to +5V. Then I would use a dual supply e.g -10V 0V +10V
then have transistor push pull arrangement and bias so +5 from cap= +10V, 2.5V from cap = 0 V and 0v form cap = -10V. That is if you don't want sine-wave offset to a +ve voltage.
If you do then PWM resistor and electrolytic cap method , would use least amount of components, but this is my theory, not tried practical to produce a sine wave. The only thing related I have successfully done, is measure pwm duty, and converted this duty to another duty to control a FET which via a brdge rectifier controlled a 230V AC fan. This means the fan ran much quieter at low speeds and did not have the mains hum associated with triac control. Or you can use DAC as in bens suggestion.
then have transistor push pull arrangement and bias so +5 from cap= +10V, 2.5V from cap = 0 V and 0v form cap = -10V. That is if you don't want sine-wave offset to a +ve voltage.
If you do then PWM resistor and electrolytic cap method , would use least amount of components, but this is my theory, not tried practical to produce a sine wave. The only thing related I have successfully done, is measure pwm duty, and converted this duty to another duty to control a FET which via a brdge rectifier controlled a 230V AC fan. This means the fan ran much quieter at low speeds and did not have the mains hum associated with triac control. Or you can use DAC as in bens suggestion.
Martin
-
- Posts: 94
- Joined: Wed Jul 16, 2008 4:39 pm
- Location: Philippines
- Been thanked: 1 time
- Contact:
Re: Sine Wave
Hello,
Sorry but I didn't get how to produce sine wave in flowcode
How is this done in flowcode for sine wave to go negative?
I would like to try to do this too using PIC16F628a.
Sorry but I didn't get how to produce sine wave in flowcode
How is this done in flowcode for sine wave to go negative?
I would like to try to do this too using PIC16F628a.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Sine Wave
Hello Mimiyum
The best way to get a negative voltage would be to use Flowcode to create your sine wave 100% in the positive side of the voltage with "zero crossings" being at about 2.5V.
Once you have done this you should be able to use some simple analogue electronics to shift the sine wave so that the lower half moves into the negative and the "zero crossings" are actually at 0V.
The best way to get a negative voltage would be to use Flowcode to create your sine wave 100% in the positive side of the voltage with "zero crossings" being at about 2.5V.
Once you have done this you should be able to use some simple analogue electronics to shift the sine wave so that the lower half moves into the negative and the "zero crossings" are actually at 0V.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 2
- Joined: Thu Oct 15, 2009 1:26 pm
- Contact:
Re: Sine Wave
Hello Benj:
Sorry for my absence, i been away from home and thanks for the replies.
Please, give me idea on using both options (DAC and PWM), to generate the sine wave.
Regards,
Astrea
Sorry for my absence, i been away from home and thanks for the replies.
Please, give me idea on using both options (DAC and PWM), to generate the sine wave.
Regards,
Astrea
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Sine Wave
Hello,
Here is a good look up table example to get you started. Basically you save a portion of the sine wave into memory and then step through the memory to move through the sine wave. You then simply output the values to the PWM or DAC as you go along.
http://www.matrixmultimedia.com/mmforum ... =26&t=4869
Here is a good look up table example to get you started. Basically you save a portion of the sine wave into memory and then step through the memory to move through the sine wave. You then simply output the values to the PWM or DAC as you go along.
http://www.matrixmultimedia.com/mmforum ... =26&t=4869
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Sine Wave
Hello Astrea.
Did you have any success, or would you like some further assistance?
If you require assistance, I maybe able to help you out with some simple circuity to convert PWM directly to a sine wave
Did you have any success, or would you like some further assistance?
If you require assistance, I maybe able to help you out with some simple circuity to convert PWM directly to a sine wave
Martin