資源簡介
在Keil u4 for ARM 下增加 C51支持的擴展包
代碼片段和文件信息
#include?
/*?
?*?the?following?timer?interrupt?routine?increments?TimerTick?and?sets?a?global?flag?to?blink?the?LED
?*/
#define?PERIOD?????-250???????????????????//?250?clock?cycles?interrupt?period
unsigned?int??TimerTick;??????????????????//?variable?to?count?interrupts
bit???????????TimeOver;???????????????????//?flag?for?main?function?to?toggle?port?pin
void?timer0?(void)?interrupt?1?using?1{???//?Int?Vector?at?000BH?Reg?Bank?1
??TimerTick++;????????????????????????????//?increment?interrupt?counter
??if?(TimerTick?>?200)?{
????TimeOver??=?1;????????????????????????//?set?event
????TimerTick?=?0;
??}
}
/*------------------------------------------------
The?main?C?function.??Program?execution?starts
here?after?stack?initialization.
------------------------------------------------*/
void?main?(void)?{
/*?setup?the?timer?0?interrupt?*/
??TH0???=?(unsigned?char)?PERIOD;????????//?set?timer?period
??TL0???=?(unsigned?char)?PERIOD;
??TMOD?|=?TMOD?|?0x02;???????????????????//?select?mode?2
??TR0???=?1;?????????????????????????????//?start?timer?0
??ET0???=?1;?????????????????????????????//?enable?timer?0?interrupt
??EA????=?1;?????????????????????????????//?global?interrupt?enable
??while?(1)?{
????while(!TimeOver);????????????????????//?wait?until?interrupt?service?routine?sets?flag
????P3?^=?0x10;??????????????????????????//?blink?LED?on?board
????TimeOver?=?0;
??}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????3097??2009-05-07?14:36??C51\ASM\89c51ic2.inc
?????文件???????3097??2009-05-07?14:36??C51\ASM\89c51ix2.inc
?????文件???????2919??2009-05-07?14:36??C51\ASM\89c51RB2.inc
?????文件???????2919??2009-05-07?14:36??C51\ASM\89c51RC2.inc
?????文件???????2919??2009-05-07?14:36??C51\ASM\89c51Rx2.inc
?????文件???????9567??2009-05-07?14:36??C51\ASM\at83C5123.inc
?????文件???????3281??2009-05-07?14:36??C51\ASM\AT898252.INC
?????文件???????3551??2009-05-07?14:36??C51\ASM\at89c5114.inc
?????文件???????4054??2009-05-07?14:36??C51\ASM\at89c51cc03.inc
?????文件???????3156??2009-05-07?14:36??C51\ASM\at89c51xd2.inc
?????文件???????5812??2009-05-07?14:36??C51\ASM\AT89S53.INC
?????文件???????2403??2009-05-07?14:36??C51\ASM\AT8xc5103.inc
?????文件??????12738??2009-05-07?14:36??C51\ASM\at8xC5122.inc
?????文件???????9599??2009-05-07?14:36??C51\ASM\C8051F000.INC
?????文件???????6671??2009-05-07?14:36??C51\ASM\C8051F200.INC
?????文件??????28161??2009-10-05?17:31??C51\ASM\C8051F580.INC
?????文件???????3363??2009-05-07?14:36??C51\ASM\REG152.INC
?????文件???????3317??2009-05-07?14:36??C51\ASM\REG320.INC
?????文件???????2513??2009-05-07?14:36??C51\ASM\REG410.INC
?????文件???????2025??2009-05-07?14:36??C51\ASM\REG451.INC
?????文件???????2851??2009-05-07?14:36??C51\ASM\REG452.INC
?????文件???????1955??2009-05-07?14:36??C51\ASM\REG453.INC
?????文件???????3072??2009-05-07?14:36??C51\ASM\REG504.INC
?????文件???????3037??2009-05-07?14:36??C51\ASM\REG505C.INC
?????文件???????2668??2009-05-07?14:36??C51\ASM\REG505L.INC
?????文件???????4684??2009-05-07?14:36??C51\ASM\REG509.INC
?????文件???????1705??2009-05-07?14:36??C51\ASM\REG51.INC
?????文件???????2813??2009-05-07?14:36??C51\ASM\REG515.INC
?????文件???????2833??2009-05-07?14:36??C51\ASM\REG515A.INC
?????文件???????3216??2009-05-07?14:36??C51\ASM\REG515C.INC
............此處省略2108個文件信息
評論
共有 條評論