Hi,
I'm trying to implement a PWM of varying duty cycle using processor expert on MCS08PT60. But, the function setdutymode(mode) is not being enabled either in fixed value mode(under starting pulse width option) or in list of values mode( also under starting pulse width option). So, can anybody help on this or is there some other way to generate a viable duty cycle PWM?
已解决! 转到解答。
The "starting pulse width" option defines only the initial duty cycle, right after component initialization. It is also equivalent to "mode 0" option if using list of values. You may define a single value for starting pulse width, and a range of values for duty cycle, using then setdutyMS or setdutyUS, or even setduty8 or setduty16.
Hello,
First of all, check if in the "Methods" tab of Component Inspector, you have set up "generate code" option for your setdutymode function. If it does not work, you may try to use other setduty functions, just as setdutyMS or setdutyUS, or even the setduty functions that receive an 8-bit or a 16-bit number to be mapped to 0-100% duty cycle.
ya correct.thanks
But the thing is setdutyMS or setdutyUS ll be enabled only if i use fixed value setting under starting pulse width option. setDutymode must be active when i select list of values as per the dialog box. But it is not.
The "starting pulse width" option defines only the initial duty cycle, right after component initialization. It is also equivalent to "mode 0" option if using list of values. You may define a single value for starting pulse width, and a range of values for duty cycle, using then setdutyMS or setdutyUS, or even setduty8 or setduty16.
Hi,
I could get variable dutycycle PWM using setratio16() method. Thanks for that.
But I'm getting a warning "/workspace/pwmte/Project_Headers\../Generated_Code\Cpu.c:201:warning:C1420 Result of function-call is ignored". I don't know why I'm getting this. Can anybody help me out.
Thanks
I get this message all the time. If you check the syntax of your setratio16() function (place the cursor over this function, in the Methods tab of component inspector), you will notice that it returns data (byte type), and the return value is related to errors, so you can see if there were no errors with the function call. If you do not pass this value to a variable, you are ignoring the result of the function call, i.e., the error status. That's why you get the warning message.
If you do not care checking if the function call was successful (I usually do not care much, as long as the program does what I want it to), just create a dummy variable (of byte type), and place the function call result on it:
dummy = SetRatio16(x);
Then you will get rid of the warning message.