📄 tmrdemo.cpp
字号:
#include <stdio.h>
#include <conio.h>
#include "etr100.h"
#include "isr.h"
#define TMR2 0x42
#define TMRCTRL 0x43
#define IRQ11 0x73
int main( )
{
int i;
unsigned int cnt10,cnt11;
/*//////////////////////////////////////////////////
// (0) timer2's input clock = 1.14MHz
// (1) generate 10ms square wave output
// (2) timer2's output is pending to IRQ11
//////////////////////////////////////////////////*/
i = SetTMR2( 11400 );
// clearup keyboard buffer
while( kbhit( ) ) { getch( ); }
cnt11 = 0;
printf( "\n" );
// install interrupt service routines
i = InstallISR( IRQ11 );
for( ; ; )
{
if( (cnt11 != IRQ11cnt) )
{
printf( "I11=%u\r", IRQ11cnt );
cnt11 = IRQ11cnt;
}
if( kbhit( ) ) { getch( ); break; }
}
i = UninstallISR( IRQ11 );
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -