資源簡介
本節描述了在F28027芯片上的數字引腳控制輸出示例代碼。代碼中,實現了對8個led燈的跑馬燈控制。
適用范圍:本節所描述的代碼適用于F28027芯片,對于其他型號或封裝的芯片,未經測試。

代碼片段和文件信息
#include?“DSP28x_Project.h“?????//?Device?Headerfile?and?Examples?Include?File
//?Prototype?statements?for?functions?found?within?this?file.
interrupt?void?cpu_timer0_isr(void);
void?GPIO_init(void);
//void?gpio1(void);
//void?gpio2(void);
//void?gpio3(void);
//Uint32?a?=?0x000000FF;
//Uint32?b?=?0x00000001;
//Uint32?GpioInterruptFlag?=?0;
//Uint32?LED[]?=?{0x0000007F?//7個燈亮
//??????????????0x0000003F?//6個燈亮
//??????????????0x0000001F?//5個燈亮
//??????????????0x0000000F?//4個燈亮
//??????????????0x00000007?//3個燈亮
//??????????????0x00000003?//2個燈亮
//??????????????0x00000001?//1個燈亮
//??????????????0x00000000?//0個燈亮
//??????????????0x00000001?//1個燈亮
//??????????????0x00000003?//2個燈亮
//??????????????0x00000007?//3個燈亮
//??????????????0x0000000F?//4個燈亮
//??????????????0x0000001F?//5個燈亮
//??????????????0x0000003F?//6個燈亮
//??????????????0x0000007F?//7個燈亮
//??????????????0x000000FF?//8個燈亮
//};
int16?keyScanFlag?=?0;??????????????????????//按鍵掃描標志
int16?ledNumberCounter?=?0;?????????????????//LED燈數量計數器
int16?keyScanBuff[]?=?{0xFFFF0xFFFF};??????//按鍵掃描緩沖器
int16?keyStatusCurrent[]?=?{0?0};??????????//按鍵當前狀態
int16?keyStatusBackup[]?=?{0?0};???????????//按鍵之前狀態
Uint32?led[]?=?{
????????????????0x00000000
????????????????0x00000001
????????????????0x00000003
????????????????0x00000007
????????????????0x0000000F
????????????????0x0000001F
????????????????0x0000003F
????????????????0x0000007F
????????????????0x000000FF
};
void?keyScan(void);
void?ledGpio(void);
void?main(void)
{
//?Step?1.?Initialize?System?Control:-
//?PLL?WatchDog?enable?Peripheral?Clocks
//?This?example?function?is?found?in?the?DSP2802x_SysCtrl.c?file.
???InitSysCtrl();
//?Step?2.?Initialize?GPIO:
//?This?example?function?is?found?in?the?DSP2802x_Gpio.c?file?and
//?illustrates?how?to?set?the?GPIO?to?it‘s?default?state.
//?InitGpio();??//?Skipped?for?this?example
???GPIO_init();
//?Step?3.?Clear?all?interrupts?and?initialize?PIE?vector?table:
//?Disable?CPU?interrupts
???DINT;
//?Initialize?the?PIE?control?registers?to?their?default?state.
//?The?default?state?is?all?PIE?interrupts?disabled?and?flags
//?are?cleared.
//?This?function?is?found?in?the?DSP2802x_PieCtrl.c?file.
???InitPieCtrl();
//?Disable?CPU?interrupts?and?clear?all?CPU?interrupt?flags:
???IER?=?0x0000;
???IFR?=?0x0000;
//?Initialize?the?PIE?vector?table?with?pointers?to?the?shell?Interrupt
//?Service?Routines?(ISR).
//?This?will?populate?the?entire?table?even?if?the?interrupt
//?is?not?used?in?this?example.??This?is?useful?for?debug?purposes.
//?The?shell?ISR?routines?are?found?in?DSP2802x_DefaultIsr.c.
//?This?function?is?found?in?DSP2802x_PieVect.c.
???InitPieVectTable();
//?Interrupts?that?are?used?in?this?example?are?re-mapped?to
//?ISR?functions?found?within?this?file.
???EALLOW;??//?This?is?needed?to?write?to?EALLOW?protected?registers
???PieVectTable.TINT0?=?&cpu_timer0_isr;
???EDIS;????//?This?is?ne
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-07-05?15:17??28027_GPIO\
?????文件?????????492??2014-03-12?10:36??28027_GPIO\.ccsproject
?????文件???????20658??2014-03-12?10:37??28027_GPIO\.cproject
?????目錄???????????0??2018-07-05?15:17??28027_GPIO\.launches\
?????文件????????3940??2014-03-12?10:41??28027_GPIO\.launches\28027_GPIO.launch
?????文件?????????840??2014-03-12?10:36??28027_GPIO\.project
?????目錄???????????0??2018-07-05?15:17??28027_GPIO\.settings\
?????文件??????????62??2014-03-12?10:36??28027_GPIO\.settings\org.eclipse.cdt.codan.core.prefs
?????文件?????????123??2014-03-12?10:36??28027_GPIO\.settings\org.eclipse.cdt.debug.core.prefs
?????文件?????????407??2018-01-06?14:03??28027_GPIO\.settings\org.eclipse.core.resources.prefs
?????目錄???????????0??2018-07-05?15:17??28027_GPIO\__Previews\
?????文件??????148151??2014-04-28?15:09??28027_GPIO\__Previews\main.cPreview
?????文件????????4343??2017-12-05?19:41??28027_GPIO\1
?????文件???????25557??2018-01-06?09:18??28027_GPIO\2
?????目錄???????????0??2018-07-05?15:17??28027_GPIO\ASM\
?????文件????????3247??2013-08-15?12:45??28027_GPIO\ASM\DSP2802x_CodeStartBranch.asm
?????文件????????2575??2013-09-05?15:16??28027_GPIO\ASM\DSP2802x_CSMPasswords.asm
?????文件????????2646??2013-08-15?12:45??28027_GPIO\ASM\DSP2802x_usDelay.asm
?????目錄???????????0??2018-07-05?15:17??28027_GPIO\Debug\
?????文件???????34673??2018-01-28?14:56??28027_GPIO\Debug\28027_GPIO.map
?????文件??????105098??2018-01-28?14:56??28027_GPIO\Debug\28027_GPIO.out
?????文件??????129261??2018-01-28?14:56??28027_GPIO\Debug\28027_GPIO_li
?????目錄???????????0??2018-07-05?15:17??28027_GPIO\Debug\ASM\
?????文件????????1838??2017-12-05?19:42??28027_GPIO\Debug\ASM\DSP2802x_CodeStartBranch.obj
?????文件?????????861??2017-12-05?19:41??28027_GPIO\Debug\ASM\DSP2802x_CSMPasswords.obj
?????文件????????1539??2017-12-05?19:42??28027_GPIO\Debug\ASM\DSP2802x_usDelay.obj
?????文件????????2087??2018-01-28?14:56??28027_GPIO\Debug\ASM\subdir_rules.mk
?????文件????????1023??2018-01-28?14:56??28027_GPIO\Debug\ASM\subdir_vars.mk
?????文件?????????541??2018-01-28?14:56??28027_GPIO\Debug\ccsObjs.opt
?????文件????????2847??2018-01-28?14:56??28027_GPIO\Debug\main.d
?????文件???????25153??2018-01-28?14:56??28027_GPIO\Debug\main.obj
............此處省略87個文件信息
- 上一篇:基于MPI并行計算的高斯消元法程序
- 下一篇:軟件著作權多人合作開發協議書模板
評論
共有 條評論