📄 mc9s12tool.mdl
字号:
}
Block {
BlockType DataTypeConversion
Name "Data Type Conversion"
Position [160, 56, 215, 84]
DataType "single"
}
Block {
BlockType "S-Function"
Name "SEND_USR_DATA"
Ports [1]
Position [315, 50, 420, 90]
FontSize 12
FunctionName "s0_userTel_txd"
Parameters "sampletime, channel, buf_size, data_type"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
}
Line {
SrcBlock "Data Type Conversion"
SrcPort 1
DstBlock "SEND_USR_DATA"
DstPort 1
}
Line {
SrcBlock "In1"
SrcPort 1
DstBlock "Data Type Conversion"
DstPort 1
}
}
}
Block {
BlockType SubSystem
Name "Servo Motor PWM"
Ports [1]
Position [50, 469, 190, 551]
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 "Sonar"
Ports [0, 1]
Position [455, 280, 595, 360]
List {
ListType RTWdata
portStr "PORTA"
ddrStr "DDRA"
pinStr "6"
}
FontSize 12
ShowPortLabels off
TreatAsAtomicUnit off
MaskPromptString "Output Port (see hardware manuals for valid opt"
"ions)|Ouput Pin (see hardware manuals for valid options)|Input Port (see hard"
"ware manuals for valid options)|Input Pin (see hardware manuals for valid opt"
"ions)|Sample time"
MaskStyleString "popup(Port A|Port B|Port H|Port J|Port M|Port P"
"|Port S|Port T),popup(0|1|2|3|4|5|6|7),popup(Port A|Port B|Port H|Port J|Port"
" M|Port P|Port S|Port T),popup(0|1|2|3|4|5|6|7),edit"
MaskTunableValueString "off,off,off,off,off"
MaskCallbackString "||||"
MaskEnableString "on,on,on,on,on"
MaskVisibilityString "on,on,on,on,on"
MaskToolTipString "on,on,on,on,on"
MaskVarAliasString ",,,,"
MaskVariables "out_port=@1;out_pin=@2;in_port=@3;in_pin=@4;sam"
"pletime=@5;"
MaskInitialization "[out_portstr, out_pinstr, in_portstr, in_pinstr"
"] = mbc_sonar(out_port, out_pin, in_port, in_pin, sampletime);"
MaskDisplay "fprintf('Output\\n%s Pin %s\\nInput\\n%s Pin %s"
"', out_portstr, out_pinstr, in_portstr, in_pinstr)"
MaskSelfModifiable on
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
MaskValueString "Port T|0|Port T|1|0.02"
System {
Name "Sonar"
Location [262, 81, 719, 287]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "A4"
PaperUnits "centimeters"
ZoomFactor "100"
Block {
BlockType "S-Function"
Name "sonar pulse"
Tag "MC9S12target"
Ports [0, 1]
Position [40, 91, 165, 129]
List {
ListType RTWdata
out_portStr "PTT"
out_ddrStr "DDRT"
out_pinMask "1"
out_pinStr "0"
in_portStr "PTT"
in_ddrStr "DDRT"
in_pinMask "2"
in_pinStr "1"
}
FontSize 12
FunctionName "sonar_sfcn_9S12"
Parameters "sampletime, out_port, out_pin, in_port, in_"
"pin"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
}
Block {
BlockType Outport
Name "Out1"
Position [340, 101, 360, 119]
}
Line {
SrcBlock "sonar pulse"
SrcPort 1
DstBlock "Out1"
DstPort 1
}
}
}
Block {
BlockType SubSystem
Name "Timer"
Ports [1]
Position [640, 276, 815, 364]
AncestorBlock "mc9S12tool/Digital output"
List {
ListType RTWdata
portStr "PORTA"
ddrStr "DDRA"
pinStr "6"
}
FontSize 12
ShowPortLabels off
TreatAsAtomicUnit off
MaskHelp "helpview('C:\\Freescale\\rtmc9S12_CW_R13\\bin\\"
"mc9S12.map', 'mc9S12_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|Output Compare|0.3|0.1"
System {
Name "Timer"
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 "3"
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 "fuzzy controller"
Tag "MC9S12target_fuzzy"
Ports [3, 1]
Position [520, 449, 720, 551]
AncestorBlock "mc9S12tool/Digital output"
List {
ListType RTWdata
InputMSFs " absentry fuzzy_controller_fuzvar
f"
"uzzy_controller_fuzvar: ds.b 15
fuzzy_controller_x1_N2: equ 0
fuzzy"
"_controller_x1_N1: equ 1
fuzzy_controller_x1_Z: equ 2
fuzzy_control"
"ler_x1_P1: equ 3
fuzzy_controller_x1_P2: equ 4
fuzzy_controller_x2_"
"N2: equ 5
fuzzy_controller_x2_N1: equ 6
fuzzy_controller_x2_Z: "
"equ 7
fuzzy_controller_x2_P1: equ 8
fuzzy_controller_x2_P2: equ 9
"
"fuzzy_controller_x3_N2: equ 10
fuzzy_controller_x3_N1: equ 11
fuzzy"
"_controller_x3_Z: equ 12
fuzzy_controller_x3_P1: equ 13
fuzzy_contr"
"oller_x3_P2: equ 14
"
OutputMSFs " absentry fuzzy_controller_fuzout
f"
"uzzy_controller_fuzout: ds.b 13
fuzzy_controller_out_C1: equ 15
fuz"
"zy_controller_out_C2: equ 16
fuzzy_controller_out_C3: equ 17
fuzzy_"
"controller_out_C4: equ 18
fuzzy_controller_out_C5: equ 19
fuzzy_con"
"troller_out_C6: equ 20
fuzzy_controller_out_C7: equ 21
fuzzy_contro"
"ller_out_C8: equ 22
fuzzy_controller_out_C9: equ 23
fuzzy_controlle"
"r_out_C10: equ 24
fuzzy_controller_out_C11: equ 25
fuzzy_controller"
"_out_C12: equ 26
fuzzy_controller_out_C13: equ 27
"
InputMSFdef "fuzzy_controller_x1_tab: dc.b 0, 64, 0, "
"4
dc.b 0, 128, 4, 4
dc.b 64, 192, 4, 4
"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -