dear sir ,
i am learning how to work on dspic33f for my project on vector control. so in the beginning i am using ur blockset to generate small porgrams for -
1) a/d converter (this program generates the mplab file without error)
2) sinusoidal pwm generator(this program generates a code which at the end gives a matlab error and the mplab file made cannot be built)
the following error report comes at the matlab command window :-
pwm1_main.o(.text+0x4):C:\Documents and Settings\Tapesh\My Documents\MATLAB\pwm1_dspic\sources\pwm1_main.c: undefined reference to `pwm1_SetEventsForThisBaseStep'
c:\program files\microchip\mplabc30\v3.25\bin\bin\..\bin/pic30-coff-ld.exe: link errors found, deleting executable `..\../pwm1.cof'
gmake: *** [..\../pwm1.cof] Error 255
### Real-Time Workshop build procedure for model: 'pwm1' aborted due to an error.
please look into and tell me if i am making any mistake in the simulink blockset .
i am sending the simulink model for a/d convertor (working),pwm1(not working) and the command window text after compilation.
thanking you
yours faithfully
chetan
error generating code using blockset
error generating code using blockset
- Attachments
-
- matlab command window.txt
- this is the command window text
- (12.92 KiB) Downloaded 734 times
-
- pwm1.mdl
- this is not working
- (30.86 KiB) Downloaded 725 times
-
- ad_display.mdl
- this model is working
- (30.17 KiB) Downloaded 738 times
Re: error generating code using blockset
I don't think you can use the Sumulink embedded PWM generator at such a high carrier frequency, especially since your timestep is set to 1ms. If you want to generate a PWM output from the PIC microcontroller look into using "Output Compare" and set the module to mode 5 where you set the up-time and the period of the OC block. I have attached a sample program that can be used to control a servo for a PIC32.
PS: Note that in the model, The input of AN0 is a Signed Integer which adds or subtracts from the servo neutral constant (1.5ms).
PPS: The servo neutral value is generated by multiplying the OC2max constant(which represents the value of 20ms) by .075 to get a constant that represents the neutral value of 1.5ms.
PPPS: If you get into using multiple PWM outputs, you will find that there can only be one OC block which you can specify multiple outputs by setting the output channels to something like the following: [1 2 3]
PS: Note that in the model, The input of AN0 is a Signed Integer which adds or subtracts from the servo neutral constant (1.5ms).
PPS: The servo neutral value is generated by multiplying the OC2max constant(which represents the value of 20ms) by .075 to get a constant that represents the neutral value of 1.5ms.
PPPS: If you get into using multiple PWM outputs, you will find that there can only be one OC block which you can specify multiple outputs by setting the output channels to something like the following: [1 2 3]
- Attachments
-
- POTtoPWM.mdl
- Working model to control servo.
- (33.03 KiB) Downloaded 779 times
Who is online
Users browsing this forum: No registered users and 137 guests