📄 setupadvanced.mac
字号:
__var _fileHandle;
__var _interruptID;
__var _breakID;
execUserSetup() {
__message "execUserSetup() called\n";
// 调用模拟仿真设置
SimulationSetup ();
}
execUserReset() {
__message "execUserReset() called\n";
if( _fileHandle ) {
__resetFile( _fileHandle );
}
}
execUserExit() {
__message "execUserExit() called\n";
// 调用模拟仿真关闭
SimulationShutdown();
}
SimulationSetup() {
// 打开文本文件InputData.txt读取ASCII码
_fileHandle = __openFile( "$PROJ_DIR$\\InputData.txt", "r" );
if( !_fileHandle ) {
__message "could not open file" ;
}
_interruptID = __orderInterrupt( "IRQ", 4000, 2000, 0, 0, 0, 100 );
if( -1 == _interruptID ) {
__message "ERROR: syntax error in interrupt description";
}
// 设置立即断点
_breakID = __setSimBreak( "UARTRBRTHR", "R", "Access()" );
}
Access() {
__message "Access() called\n";
// 从文件中读取fib数列
__var _fibValue;
if( 0 == __readFile( _fileHandle, &_fibValue)) {
UARTRBRTHR = _fibValue;
}
else {
__message "error reading value from file";
}
__message "UARTRBR = 0x", _fibValue:%X,"\n";
}
SimulationShutdown() {
__cancelInterrupt( _interruptID );
__clearBreak( _breakID );
__closeFile( _fileHandle );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -