Page 1 of 1

c code and mplab

Posted: Wed May 09, 2007 8:55 pm
by arci
can we make a project in mplab with c code(s) which are generated in your tool.

Thanks

Posted: Sun May 13, 2007 2:09 am
by LubinKerhuel
I get some C files transferred into MPLAB with the new microchip tool. But Compilation with MPLAB was not successful.

I gave up with the microchip 'Matlab function' since I am a simulink uses and I prefer to add my C code directly into the simulink model ( using the C function block or using the C that can be added directly in the Real Time Workshop configuration dialog box of simulink). Note however that I added C code only once until now.

I never had to debug using MPLAB a model generated with simulink. I have no more erratic peripheral behaviour (like the first time you try to make them work ! ). I concentrate only on the logic, the math and the fixed point optimization problems of my model.

If you can provide one good reason to look further so as to make the microchip tool work with the blockset, I will perhaps do it.

doubt in simulink c code import for any other microprocessor

Posted: Sat Jan 12, 2008 7:13 pm
by ropeekollee
hello sir,

i have created a pwm circuit using simulink and i have generated the c code using RTW in simulink.. now my problem is how to import those codings in any microcontrollers or any dsp processors. i need these c codes for my hardware implementation.. can u suggest me some microcontrollers or any dsp processors which can use those simulink generated c code..


thank u..

Re: c code and mplab

Posted: Sat Jan 12, 2008 10:52 pm
by LubinKerhuel
ropeekollee,

C code generated by simulink can be imported into any microcontrollers or DSP that have a C compiler which can compile "standard C".

Anyway, most microcontrollers (and dsPIC) have an PWM peripheral. In other word, the PWM signal is generated by the internal electronics. You just need to set-up the peripheral. The block Output Capture (OC) or PWM motor generate the C code that set up and configure the peripheral for dsPIC for you if you use a dsPIC.