How can I create sinus wave by using TI C2000 launchpad and simulink?

I am new to microcontrollers. I want to create sinus wave and read it with oscilloscope by using F28379D but I couldn't manage to do that. Which blocks should I use to do that?
Thanks.

 Risposta accettata

Hello Batuhan,
  1. Open a blank Simulink model, go the configuration parameters (Ctrl+E) > Hardware Implementation > Select the board you are using (i.e. F28379D LaunchPad)
  2. Drag a DAC block in your model from the Simulink library browser, under Embedded Coder Support Package for TI C2000 > F2837xD
  3. Drag a sine wave source block from Simulink source blocks, double-click on the sine wave and select "Sample based" for the sine type, set the Amplitude to 2047.5, Bias 2047.5, Samples per period: 100, Sample time: .01 --> this will generate a 1Hz sine wave with 100 points oscillating from 0 to 4095, which is the range that the DAC wants.
  4. Connect the Sine wave to the DAC
  5. Make sure your board is connected to your computer and generate code for the model (Ctrl+B)
  6. Put a scope on the DAC pin (Pin 30 on connector J3 is using the Launchpad) and enjoy watching the sine wave oscillate
  7. Accept this answer and post your model so others can benefit from it :-), go to this page and rate the package 5 stars, feel free to share with the rest of the world how easy it was to run your first model with our TI C2000 support package.

9 Commenti

Hi,
I came across this while googling something similar. If I want to generate a constant voltage on the DAC of the F28379D Launchpad, will it work if I set-up my simulink model as shown in the attached image?
Thanks in advance!
Hi Why pin 30?
accord to the MATLAB Documentation of C2837x/07x DAC:
The pins that are shared between ADC and DAC are DACOUTA/ADCINA0, DACOUTB/ADCINA1, and DACOUTC/ADCINB1.
In Lauchpad -F28379D, ADCINA0 is at PIN 30 of J3.
But I don't know what's mean of pin 31 and 32 of J4, thay noted as DAC2 and DAC1 in the quick start :(
Pin 31 and 32 of J4, is referred as PWMDAC in schematic of the launchpad. That is different from the DAC module in Analog subsystem.
How to create a function in c2000 from matlab .m file to dac ? And also I don't get how to use dac a , dac b and dac c Not getting the pin no as in data sheet it's given as dac 1 ,2,3,4 plz help me out
@Antonin Hello,
I have designed MPC controller in simulink and I want to send the output of MPC controller to my real time device, and receive two input from device.
How can I configure F2837xD for the my configuration. Another quesyion is why you switched to sample based from time based configuration for sine wave and another question is whyd did you choosed Amplitude to 2047.5, Bias 2047.5?
It is because it has a 12bit DAC and it can take values from 0- 2^12-1. 2^12 is 4096. 2047.5 comes from 4095/2. The sine wave generated by matlab is by default [-1,1]. A bias of 1 would make it [0,2]. Similary if we enter amplitude to be 4095 it will oscillate from [-2047.5,2047.5] but negative values should not be there hence the bias of 2047.5.
Hello,
During pratice, I observe that the method described works for frequency lower than 10kHz. What can I do for a 100kHz sine wave?
Thanks for your feedback.
Regards.

Accedi per commentare.

Più risposte (0)

Prodotti

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by