📄 servo_pwm.mdl
字号:
Name "Servo_PWM"
Location [478, 239, 990, 571]
Open on
ModelBrowserVisibility off
ModelBrowserWidth 212
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "usletter"
PaperUnits "inches"
ZoomFactor "100"
ReportName "simulink-default.rpt"
Block {
BlockType Constant
Name "Constant"
Position [50, 110, 80, 140]
FontSize 12
}
Block {
BlockType Constant
Name "Constant1"
Position [50, 235, 80, 265]
FontSize 12
}
Block {
BlockType SubSystem
Name "Servo Motor PWM"
Ports [1]
Position [340, 84, 480, 166]
FontSize 12
TreatAsAtomicUnit off
MaskHelp "helpview('C:\\Freescale\\rtmc9S12_CW_R13\\bin\\"
"mc9S12.map', 'mc9S12_servoPWM_In_blkref')"
MaskPromptString "Sample time|PWM period (16-bit : up to 179 s)|M"
"inimum pulse width|Maximum pulse width|Resolution |Pulse pin (PTP) "
" |Saturation input level [simulated voltage]"
MaskStyleString "edit,edit,edit,edit,popup(8 bit|16 bit),popup(0"
" (8-bit)|1 (8-bit / 16-bit)|2 (8-bit)|3 (8-bit / 16-bit)|4 (8-bit)|5 (8"
"-bit / 16-bit)|6 (8-bit)|7 (8-bit / 16-bit)),edit"
MaskTunableValueString "on,on,on,on,on,off,on"
MaskCallbackString "||||||"
MaskEnableString "on,on,on,on,on,on,on"
MaskVisibilityString "on,on,on,on,on,on,on"
MaskToolTipString "on,on,on,on,on,on,on"
MaskVarAliasString ",,,,,,"
MaskVariables "sampletime=@1;PWMperiod=@2;minwidth=@3;maxwidth"
"=@4;resolution=@5;pulse_pin=@6;Vmax=@7;"
MaskInitialization "[pulsepinstr, periodstr, clkABstr, resolutionst"
"r] = mbc_servopwmoutput(sampletime, PWMperiod, minwidth, maxwidth, resolution"
", pulse_pin, Vmax);\n"
MaskDisplay "fprintf('Servo motor PWM\\n(PWM clk: %s, %s-bit"
")\\nPeriod: %s\\nPulse pin: PTP.%s\\nSaturation: %d', clkABstr, resolutionstr"
", periodstr, pulsepinstr, Vmax)"
MaskSelfModifiable on
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
MaskValueString "0.02|0.02|0.0006|0.0020|16 bit|1 (8-bit / 16-b"
"it)|1"
System {
Name "Servo Motor PWM"
Location [440, 403, 875, 514]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "A4"
PaperUnits "centimeters"
ZoomFactor "100"
Block {
BlockType Inport
Name "In1"
Position [50, 40, 70, 60]
FontSize 12
}
Block {
BlockType "S-Function"
Name "servo pwm"
Tag "MC9S12target_pwm"
Ports [1]
Position [140, 30, 295, 70]
List {
ListType RTWdata
pulsepinStr "1"
pulsepinMask "2"
resolutionStr "16"
CLKselectStr "0"
useSCLStr "1"
PCKStr "0"
PWMSCLStr "4"
dutyMINStr "1800"
dutyMAXStr "6000"
PERIODStr "1800"
}
FontSize 12
FunctionName "servo_pwm_sfcn_9S12"
Parameters "sampletime, PWMperiod, pulse_pin, Vmax"
}
Line {
SrcBlock "In1"
SrcPort 1
DstBlock "servo pwm"
DstPort 1
}
}
}
Block {
BlockType SubSystem
Name "Servo Motor PWM1"
Ports [1]
Position [340, 209, 480, 291]
FontSize 12
TreatAsAtomicUnit off
MaskHelp "helpview('C:\\Freescale\\rtmc9S12_CW_R13\\bin\\"
"mc9S12.map', 'mc9S12_servoPWM_In_blkref')"
MaskPromptString "Sample time|PWM period (16-bit : up to 179 s)|M"
"inimum pulse width|Maximum pulse width|Resolution |Pulse pin (PTP) "
" |Saturation input level [simulated voltage]"
MaskStyleString "edit,edit,edit,edit,popup(8 bit|16 bit),popup(0"
" (8-bit)|1 (8-bit / 16-bit)|2 (8-bit)|3 (8-bit / 16-bit)|4 (8-bit)|5 (8"
"-bit / 16-bit)|6 (8-bit)|7 (8-bit / 16-bit)),edit"
MaskTunableValueString "on,on,on,on,on,off,on"
MaskCallbackString "||||||"
MaskEnableString "on,on,on,on,on,on,on"
MaskVisibilityString "on,on,on,on,on,on,on"
MaskToolTipString "on,on,on,on,on,on,on"
MaskVarAliasString ",,,,,,"
MaskVariables "sampletime=@1;PWMperiod=@2;minwidth=@3;maxwidth"
"=@4;resolution=@5;pulse_pin=@6;Vmax=@7;"
MaskInitialization "[pulsepinstr, periodstr, clkABstr, resolutionst"
"r] = mbc_servopwmoutput(sampletime, PWMperiod, minwidth, maxwidth, resolution"
", pulse_pin, Vmax);\n"
MaskDisplay "fprintf('Servo motor PWM\\n(PWM clk: %s, %s-bit"
")\\nPeriod: %s\\nPulse pin: PTP.%s\\nSaturation: %d', clkABstr, resolutionstr"
", periodstr, pulsepinstr, Vmax)"
MaskSelfModifiable on
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
MaskValueString "0.02|0.02|0.0006|0.0020|16 bit|3 (8-bit / 16-b"
"it)|1"
System {
Name "Servo Motor PWM1"
Location [440, 403, 875, 514]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "A4"
PaperUnits "centimeters"
ZoomFactor "100"
Block {
BlockType Inport
Name "In1"
Position [50, 40, 70, 60]
FontSize 12
}
Block {
BlockType "S-Function"
Name "servo pwm"
Tag "MC9S12target_pwm"
Ports [1]
Position [140, 30, 295, 70]
List {
ListType RTWdata
pulsepinStr "3"
pulsepinMask "8"
resolutionStr "16"
CLKselectStr "1"
useSCLStr "1"
PCKStr "0"
PWMSCLStr "4"
dutyMINStr "1800"
dutyMAXStr "6000"
PERIODStr "1800"
}
FontSize 12
FunctionName "servo_pwm_sfcn_9S12"
Parameters "sampletime, PWMperiod, pulse_pin, Vmax"
}
Line {
SrcBlock "In1"
SrcPort 1
DstBlock "servo pwm"
DstPort 1
}
}
}
Block {
BlockType Reference
Name "Slider\nGain"
Ports [1, 1]
Position [195, 108, 245, 142]
FontSize 12
SourceBlock "simulink/Math\nOperations/Slider\nGain"
SourceType "Slider Gain"
low "0"
gain "0.4"
high "1"
}
Block {
BlockType Reference
Name "Slider\nGain1"
Ports [1, 1]
Position [195, 233, 245, 267]
FontSize 12
SourceBlock "simulink/Math\nOperations/Slider\nGain"
SourceType "Slider Gain"
low "0"
gain "0.731"
high "1"
}
Line {
SrcBlock "Constant"
SrcPort 1
DstBlock "Slider\nGain"
DstPort 1
}
Line {
SrcBlock "Slider\nGain"
SrcPort 1
DstBlock "Servo Motor PWM"
DstPort 1
}
Line {
SrcBlock "Constant1"
SrcPort 1
DstBlock "Slider\nGain1"
DstPort 1
}
Line {
SrcBlock "Slider\nGain1"
SrcPort 1
DstBlock "Servo Motor PWM1"
DstPort 1
}
Annotation {
Name "Test program - Servo motor, Pulse Width Modulat"
"ion (PWM).\n The 'pulse pin' (always port PTP) carries"
" the PWM signal"
Position [27, 17]
HorizontalAlignment "left"
VerticalAlignment "top"
FontName "Times New Roman"
FontSize 14
FontWeight "bold"
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -