Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by Ric

  1. How do you include existing C code functions into an Embed model?
  2. Ric

    Include C code in your Embed Model

    This PDF explains how to convert a C file into a block that can be included in any Embed Model. Include C functions to your model.pdf
  3. Ric


    Hi Sanjeevkumar, I'm attaching a .vsm model that illustrates how to implement a while and a for loop using a compound block. I'm also attaching a ppt file that explains how to setup a do loop. While and For Loops.vsm Do Loops.pdf
  4. Ric

    To find frequency value

    Hi Priyanka, The most direct way to identify the frequency content of a signal is using the FFT option in the plot block. This technique will identify power at different frequencies over a frequency range starting at 0 Hz and going up to 1/(2*timeStep). In the example you used above, the timeStep is .01 seconds so the maximum frequency you'd be able to see in the data is 50Hz. You can test this by applying a 20Hz sinwave to a plot with timeStep = .01, select FFT, and you'll see a spike at 20 Hz only and the frequency range will begin at 0 and go to 50 Hz. Ric
  5. Ric

    HOW to debug MSP430 BY EMBED?

    Hi Trido, The HotLink (Target Interface block) is not supported on the MSP430 because the JTAG unit always halts the CPU on an access making it unusable for control development. Ric
  6. Hi Trido, I'm attaching some information explaining how to setup and use the Embed SPI, you will need to modify it to fit your communication constraints. Ric SPI_RK.pdf
  7. Ric

    Licensing for Altair Embed Basic

    Hi Jason S., Yes, Altair Embed Basic can be used for professional applications at your job. Ric
  8. Ric

    cycle instead of time based calculation

    You would need to use a discrete feedback system to solve this problem. In the model (below), your equation is implemented as; WF = WF_PreviousValue + AWA – SOA You need to specify the initial value of WF_PreviousValue on the first pass of the simulation. I have used the variable WF_Initial_Value (below) for this , you will need to assign it a value.
  9. Attached is a model that will allow you to adjust the phase lag between PWM1A and PWM2A on a F28069M launchpad. First generate code from the compound block entitled "PWM Phase Control" located in the "PWM with PhaseShiftv2.vsm" source model. Next, open the model "PWM with PhaseShiftv2-d.vsm", make sure the target interface block is pointing to the ".out" file you created in the first step, and run it. You will be able to adjust the duty cycle fraction as well as the phase angle fraction using the sliders. PWM with Phase Shiftv2.vsm PWM with Phase Shiftv2-d.vsm
  10. I want to create two pwm signals with the same duty cycle but one having a phase offset from the other
  11. Ric

    Implementing while and for loop

    Hi Nit, I'm attaching an example model that shows you one approach to creating a "For" loop and a "While" loop using Embed compound blocks. Ric While and For Loops.vsm
  12. Ric

    Discrete Transfer Function Problem

    Hi Joshep, You need to be careful when using discrete transfer functions. The values to the right of the decimal are very important, if you truncate them you can get significantly different results. I applied the "reg" signal created from the two "Bezier" blocks to three transfer functions; 1. The transfer function typed into this correspondance (red) 2. The transfer function from your .vsm model executed on a 64 bit computer (blue) 3. Same as 2. but executed on a 32 bit computer (green) On the traces below, you'll see how important it is not to truncate coefficients by comparing the red response with either the blue or green. The blue response is the correct response. If you had codegen'd the transfer function and run that code on a 32 bit microcontroller, you'd get the green response which clearly has some noise problems. I've also attached the model used to generate these responses. Ric ComparisonPlots.vsm