📄 timer.mdl
字号:
", timerPINstr)\n% these can be used in the Icon page. Replace that line by th"
"e following:\n% fprintf('Channel: %s\\nMode: %s\\n%sPeriod: %s\\nResolution: "
"%s', timerChannelstr, timerModestr, timerOptPORTstr, timerPeriodstr, ECTResol"
"utionstr)\n% \n% [timerChannelstr, timerModestr, timerPORTstr, timerPINstr, t"
"imerPeriodstr, ECTResolutionstr] = mbc_timer(timerChannel, timerMode, timerOC"
"port, timerOCpin, timerPeriod, sampletime);\n% \n% if(timerMode == 1)\n% "
" % OC -> display port / pin\n% timerOptPORTstr = ['Toggle: ' t"
"imerPORTstr ', Pin(s): ' timerPINstr '\\n'];\n% else\n% % IC -> don't"
" display port / pin\n% timerOptPORTstr = '';\n% end\n"
MaskDisplay "fprintf('Channel: %s\\nMode: %s\\nPeriod: %s\\n"
"Resolution: %s', timerChannelstr, timerModestr, timerPeriodstr, ECTResolution"
"str)\n"
MaskSelfModifiable on
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
MaskValueString "Channel 2|Output Compare|0.0001|0.1"
System {
Name "Timer1"
Location [262, 81, 732, 200]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "A4"
PaperUnits "centimeters"
ZoomFactor "100"
Block {
BlockType Inport
Name "In1"
Position [150, 50, 170, 70]
FontSize 12
}
Block {
BlockType "S-Function"
Name "Timer Block"
Tag "MC9S12target_timer"
Ports [1]
Position [200, 41, 335, 79]
List {
ListType RTWdata
timerChannel "2"
timerMode "1"
timerPeriod "0.0001"
timerResolution "5.3333e-006"
}
FontSize 12
FunctionName "timer_sfcn_9S12"
Parameters "sampletime, timerMode"
}
Line {
SrcBlock "In1"
SrcPort 1
DstBlock "Timer Block"
DstPort 1
}
}
}
Block {
BlockType SubSystem
Name "Timer2"
Ports [1]
Position [435, 61, 610, 149]
AncestorBlock "mc9S12tool/Digital output"
List {
ListType RTWdata
portStr "PORTA"
ddrStr "DDRA"
pinStr "6"
}
FontSize 12
ShowPortLabels off
TreatAsAtomicUnit off
MaskHelp "helpview('C:\\Documents and Settings\\fwornle\\"
"My Documents\\frank\\_cProgs\\Motorola\\rtmc9S12_CW_R13\\bin\\mc9S12.map', 'm"
"c9S12_DOUT_In_blkref')"
MaskPromptString "Timer channel|Timer mode|Timer base period (sec"
"onds)|Sample time"
MaskStyleString "popup(Channel 0|Channel 1|Channel 2|Channel 3|C"
"hannel 4|Channel 5|Channel 6),popup(Output Compare|Input Capture),edit,edit"
MaskTunableValueString "off,off,off,off"
MaskCallbackString "|||"
MaskEnableString "on,on,on,on"
MaskVisibilityString "on,on,on,on"
MaskToolTipString "on,on,on,on"
MaskVarAliasString ",,,"
MaskVariables "timerChannel=@1;timerMode=@2;timerPeriod=@3;sam"
"pletime=@4;"
MaskInitialization "if(timerMode == 1)\n % OC\n timer"
"PeriodTypestr = 'Period:';\nelse\n % IC\n timerPeriodTypestr = "
"'Measurement intvl:';\nend\n\n[timerChannelstr, timerModestr, timerPeriodstr,"
" ECTResolutionstr] = mbc_timer(timerChannel, timerMode, timerPeriod, sampleti"
"me);\n\n% future extension: allow for output port / pin selection\n% this has"
"n't been implemented yet, as it would require the \n% interrupt service handl"
"ers to be configured by TLC\n% fw-09-06\n%\n% the following code assumes that"
" timerOCport and timerOCpin have been defined similarly to what's done in mbc"
"_ditaloutput.m\n% the function also returns two more parameters (timerPORTstr"
", timerPINstr)\n% these can be used in the Icon page. Replace that line by th"
"e following:\n% fprintf('Channel: %s\\nMode: %s\\n%sPeriod: %s\\nResolution: "
"%s', timerChannelstr, timerModestr, timerOptPORTstr, timerPeriodstr, ECTResol"
"utionstr)\n% \n% [timerChannelstr, timerModestr, timerPORTstr, timerPINstr, t"
"imerPeriodstr, ECTResolutionstr] = mbc_timer(timerChannel, timerMode, timerOC"
"port, timerOCpin, timerPeriod, sampletime);\n% \n% if(timerMode == 1)\n% "
" % OC -> display port / pin\n% timerOptPORTstr = ['Toggle: ' t"
"imerPORTstr ', Pin(s): ' timerPINstr '\\n'];\n% else\n% % IC -> don't"
" display port / pin\n% timerOptPORTstr = '';\n% end\n"
MaskDisplay "fprintf('Channel: %s\\nMode: %s\\nPeriod: %s\\n"
"Resolution: %s', timerChannelstr, timerModestr, timerPeriodstr, ECTResolution"
"str)\n"
MaskSelfModifiable on
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
MaskValueString "Channel 1|Output Compare|0.3|0.1"
System {
Name "Timer2"
Location [262, 81, 732, 200]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "A4"
PaperUnits "centimeters"
ZoomFactor "100"
Block {
BlockType Inport
Name "In1"
Position [150, 50, 170, 70]
FontSize 12
}
Block {
BlockType "S-Function"
Name "Timer Block"
Tag "MC9S12target_timer"
Ports [1]
Position [200, 41, 335, 79]
List {
ListType RTWdata
timerChannel "1"
timerMode "1"
timerPeriod "0.3"
timerResolution "5.3333e-006"
}
FontSize 12
FunctionName "timer_sfcn_9S12"
Parameters "sampletime, timerMode"
}
Line {
SrcBlock "In1"
SrcPort 1
DstBlock "Timer Block"
DstPort 1
}
}
}
Block {
BlockType SubSystem
Name "Timer3"
Ports [0, 1]
Position [40, 161, 215, 249]
AncestorBlock "mc9S12tool/Digital output"
List {
ListType RTWdata
portStr "PORTA"
ddrStr "DDRA"
pinStr "6"
}
FontSize 12
ShowPortLabels off
TreatAsAtomicUnit off
MaskHelp "helpview('C:\\Documents and Settings\\fwornle\\"
"My Documents\\frank\\_cProgs\\Motorola\\rtmc9S12_CW_R13\\bin\\mc9S12.map', 'm"
"c9S12_DOUT_In_blkref')"
MaskPromptString "Timer channel|Timer mode|Timer base period (sec"
"onds)|Sample time"
MaskStyleString "popup(Channel 0|Channel 1|Channel 2|Channel 3|C"
"hannel 4|Channel 5|Channel 6),popup(Output Compare|Input Capture),edit,edit"
MaskTunableValueString "off,off,off,off"
MaskCallbackString "|||"
MaskEnableString "on,on,on,on"
MaskVisibilityString "on,on,on,on"
MaskToolTipString "on,on,on,on"
MaskVarAliasString ",,,"
MaskVariables "timerChannel=@1;timerMode=@2;timerPeriod=@3;sam"
"pletime=@4;"
MaskInitialization "if(timerMode == 1)\n % OC\n timer"
"PeriodTypestr = 'Period:';\nelse\n % IC\n timerPeriodTypestr = "
"'Measurement intvl:';\nend\n\n[timerChannelstr, timerModestr, timerPeriodstr,"
" ECTResolutionstr] = mbc_timer(timerChannel, timerMode, timerPeriod, sampleti"
"me);\n\n% future extension: allow for output port / pin selection\n% this has"
"n't been implemented yet, as it would require the \n% interrupt service handl"
"ers to be configured by TLC\n% fw-09-06\n%\n% the following code assumes that"
" timerOCport and timerOCpin have been defined similarly to what's done in mbc"
"_ditaloutput.m\n% the function also returns two more parameters (timerPORTstr"
", timerPINstr)\n% these can be used in the Icon page. Replace that line by th"
"e following:\n% fprintf('Channel: %s\\nMode: %s\\n%sPeriod: %s\\nResolution: "
"%s', timerChannelstr, timerModestr, timerOptPORTstr, timerPeriodstr, ECTResol"
"utionstr)\n% \n% [timerChannelstr, timerModestr, timerPORTstr, timerPINstr, t"
"imerPeriodstr, ECTResolutionstr] = mbc_timer(timerChannel, timerMode, timerOC"
"port, timerOCpin, timerPeriod, sampletime);\n% \n% if(timerMode == 1)\n% "
" % OC -> display port / pin\n% timerOptPORTstr = ['Toggle: ' t"
"imerPORTstr ', Pin(s): ' timerPINstr '\\n'];\n% else\n% % IC -> don't"
" display port / pin\n% timerOptPORTstr = '';\n% end\n"
MaskDisplay "fprintf('Channel: %s\\nMode: %s\\nPeriod: %s\\n"
"Resolution: %s', timerChannelstr, timerModestr, timerPeriodstr, ECTResolution"
"str)\n"
MaskSelfModifiable on
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
MaskValueString "Channel 3|Input Capture|0.3|0.1"
System {
Name "Timer3"
Location [262, 81, 732, 200]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "A4"
PaperUnits "centimeters"
ZoomFactor "100"
Block {
BlockType "S-Function"
Name "Timer Block"
Tag "MC9S12target_timer"
Ports [0, 1]
Position [200, 41, 335, 79]
List {
ListType RTWdata
timerChannel "3"
timerMode "2"
timerPeriod "0.34952"
timerResolution "5.3333e-006"
}
FontSize 12
FunctionName "timer_sfcn_9S12"
Parameters "sampletime, timerMode"
}
Block {
BlockType Outport
Name "Out1"
Position [385, 50, 405, 70]
FontSize 12
}
Line {
SrcBlock "Timer Block"
SrcPort 1
DstBlock "Out1"
DstPort 1
}
}
}
Block {
BlockType ZeroOrderHold
Name "Zero-Order\nHold1"
Position [330, 186, 365, 224]
ShowName off
SampleTime "0.1"
}
Block {
BlockType Reference
Name "on/off1"
Ports [1, 1]
Position [335, 90, 365, 120]
SourceBlock "simulink/Math\nOperations/Slider\nGain"
SourceType "Slider Gain"
low "0"
gain "0"
high "1"
}
Block {
BlockType Reference
Name "on/off2"
Ports [1, 1]
Position [335, 285, 365, 315]
SourceBlock "simulink/Math\nOperations/Slider\nGain"
SourceType "Slider Gain"
low "0"
gain "0"
high "1"
}
Line {
SrcBlock "Zero-Order\nHold1"
SrcPort 1
DstBlock "Display1"
DstPort 1
}
Line {
SrcBlock "Timer3"
SrcPort 1
DstBlock "Zero-Order\nHold1"
DstPort 1
}
Line {
SrcBlock "Constant1"
SrcPort 1
DstBlock "on/off1"
DstPort 1
}
Line {
SrcBlock "on/off1"
SrcPort 1
DstBlock "Timer2"
DstPort 1
}
Line {
SrcBlock "Constant2"
SrcPort 1
DstBlock "on/off2"
DstPort 1
}
Line {
SrcBlock "on/off2"
SrcPort 1
DstBlock "Timer1"
DstPort 1
}
Annotation {
Name "Test program - Timer (Output Compare and Input "
"Capture mode)"
Position [27, 22]
HorizontalAlignment "left"
VerticalAlignment "top"
FontName "Times New Roman"
FontSize 14
FontWeight "bold"
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -