Page 1 of 1

Simulation of dsPIC peripheral

Posted: Sat Jan 26, 2008 6:13 pm
by aunanshi@yahoo.com
Dear Lubin,
Is it possible to view the PWM signals in simulink platform :roll: upon "start simulation" ? for example i start simulation in the example
"servo_ADC". Like to see the simulation output before download to the chip.
Any extra thing to add in?

Regards,
Nanshi

Re: view the PWM signals in simulink platform

Posted: Sun Jan 27, 2008 12:21 am
by LubinKerhuel
Hi Nanshi,

The aim of the dsPIC blockset is not to simulate the behavior of the dsPIC or PIC24 peripheral. Its aim is to automatically generate the C code to configure these peripheral, and to integrate this code into the C code generated by Simulink and the Real Time Workshop Embedded Coder toolbox.

If you need to simulate the behavior of the dsPIC peripheral, you can do it using the standard simulink block library. However, you will probably have to reduce the time step of the model. The PWM peripheral is a good example: The resolution of the dsPIC peripheral Pulse Width is independent from the model time step! A model running on the dsPIC at 1 KHz (model time step = 1ms) could have a physical PWM resolution higher than 1ms!

If you want to simulate and to generate C using the same model, the block Environment Controller from the standard simulink library could be helpful.
Environment Controller Block
Environment Controller Block
environment_controller.png (458 Bytes) Viewed 10271 times