1T0MR0=Fpclk/2时定时0.5s
2
3#define Fosc 11059200
4#define Fcclk (Fosc * 4)
5#define Fcco (Fcclk * 4)
6#define Fpclk (Fcclk / 4) * 1
7/* 定时器0初始化 */
8T0TC = 0; /* 定时器设置为0*/
9T0PR = 0; /* 时钟不分频*/
10T0MCR = 0x03; /* 设置T0MR0匹配后复位T0TC,并产生中断标志 */
11T0MR0 = Fpclk/2; /* 0.5秒钟定时*/
12T0TCR = 0x01; /* 启动定时器*/
13
2
3#define Fosc 11059200
4#define Fcclk (Fosc * 4)
5#define Fcco (Fcclk * 4)
6#define Fpclk (Fcclk / 4) * 1
7/* 定时器0初始化 */
8T0TC = 0; /* 定时器设置为0*/
9T0PR = 0; /* 时钟不分频*/
10T0MCR = 0x03; /* 设置T0MR0匹配后复位T0TC,并产生中断标志 */
11T0MR0 = Fpclk/2; /* 0.5秒钟定时*/
12T0TCR = 0x01; /* 启动定时器*/
13
1T0MR0=Fpclk/2时定时1s
2
3#define Fosc 11059200
4#define Fcclk (Fosc * 4)
5#define Fcco (Fcclk * 4)
6#define Fpclk (Fcclk / 4) * 1
7/* 定时器0初始化 */
8T0TC = 0; /* 定时器设置为0*/
9T0PR = 99; /* 时钟不分频*/
10T0MCR = 0x03; /* 设置T0MR0匹配后复位T0TC,并产生中断标志 */
11T0MR0 = 110592; /* 0.5秒钟定时*/
12T0TCR = 0x01; /* 启动定时器*/
13
2
3#define Fosc 11059200
4#define Fcclk (Fosc * 4)
5#define Fcco (Fcclk * 4)
6#define Fpclk (Fcclk / 4) * 1
7/* 定时器0初始化 */
8T0TC = 0; /* 定时器设置为0*/
9T0PR = 99; /* 时钟不分频*/
10T0MCR = 0x03; /* 设置T0MR0匹配后复位T0TC,并产生中断标志 */
11T0MR0 = 110592; /* 0.5秒钟定时*/
12T0TCR = 0x01; /* 启动定时器*/
13