#include "DSP28x_Project.h"
#include <math.h>
void Delay_loop(void);
long Delay_length = 2142856; //150MHz 의 SYSCLK, 0.2s 지연
void main(void)
{
DINT;
IER = 0x0000;
IFR = 0x0000;
InitSysCtrl();
// SYSCLKOUT (CLKIN) = (30000*10)/2 = 150000 : 150 MHz
// InitPll(DSP28_PLLCR,DSP28_DIVSEL); 10 2에서 설정.
// peripheral clocks 설정.
EALLOW;
//GPxMUXn : 핀 기능설정, adc는 따로지정되어 있음. 0: 출력
GpioCtrlRegs.GPAMUX1.all = 0x00000000; // GPIO functionality GPIO0-GPIO15
GpioCtrlRegs.GPAMUX2.all = 0x00000000; // GPIO functionality GPIO16-GPIO31
GpioCtrlRegs.GPBMUX1.all = 0x00000000; // GPIO functionality GPIO32-GPIO39
GpioCtrlRegs.GPBMUX2.all = 0x00000000; // GPIO functionality GPIO48-GPIO63
GpioCtrlRegs.GPCMUX1.all = 0x00000000; // GPIO functionality GPIO64-GPIO79
GpioCtrlRegs.GPCMUX2.all = 0x00000000; // GPIO functionality GPIO80-GPIO95
//GPxDIR : 방향 설정
GpioCtrlRegs.GPADIR.all = 0xffffffff; // GPIO0-GPIO31
GpioCtrlRegs.GPBDIR.all = 0xffffffff; // GPIO32-GPIO63
GpioCtrlRegs.GPCDIR.all = 0xffffffff; // GPI064-GPIO95
// Each input can have different qualification
// a) input synchronized to SYSCLKOUT
// b) input qualified by a sampling window
// c) input sent asynchronously (valid for peripheral inputs only)
GpioCtrlRegs.GPAQSEL1.all = 0x0000; // GPIO0-GPIO15 Synch to SYSCLKOUT
GpioCtrlRegs.GPAQSEL2.all = 0x0000; // GPIO16-GPIO31 Synch to SYSCLKOUT
GpioCtrlRegs.GPBQSEL1.all = 0x0000; // GPIO32-GPIO39 Synch to SYSCLKOUT
GpioCtrlRegs.GPBQSEL2.all = 0x0000; // GPIO48-GPIO63 Synch to SYSCLKOUT
// Pull-ups can be enabled or disabled.
// GpioCtrlRegs.GPAPUD.all = 0x0000; // Pullup's enabled GPIO0-GPIO31
//GpioCtrlRegs.GPBPUD.all = 0x0000; // Pullup's enabled GPIO32-GPIO63
//GpioCtrlRegs.GPCPUD.all = 0x0000; // Pullup's enabled GPIO64-GPIO79
GpioCtrlRegs.GPAPUD.all = 0xFFFF; // Pullup's disabled GPIO0-GPIO31
GpioCtrlRegs.GPBPUD.all = 0xFFFF; // Pullup's disabled GPIO32-GPIO34
GpioCtrlRegs.GPCPUD.all = 0xFFFF; // Pullup's disabled GPIO64-GPIO79
EDIS;
GpioDataRegs.GPACLEAR.all = 0xffffffff; //초기 상태를 클리어.(0)
GpioDataRegs.GPBCLEAR.all = 0xffffffff; //초기 상태를 클리어.(0)
GpioDataRegs.GPCCLEAR.all = 0xffffffff; //초기 상태를 클리어.(0)
//============================================================================================
// Enable global Interrupts and higher priority real-time debug events:
//--------------------------------------------------------------------------------------------
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
//============================================================================================
for(;;)
{
Delay_loop();
GpioDataRegs.GPACLEAR.all = 0xffffffff;
GpioDataRegs.GPBCLEAR.all = 0xffffffff;
GpioDataRegs.GPCCLEAR.all = 0xffffffff;
Delay_loop();
GpioDataRegs.GPASET.all = 0xffffffff;
GpioDataRegs.GPBSET.all = 0xffffffff;
GpioDataRegs.GPCSET.all = 0xffffffff;
}
}
//============================================================================================
// Local Interrupt Service Routines & Functions
//--------------------------------------------------------------------------------------------
// 단순 딜레이 루프
//--------------------------------------------------------------------------------------------
void Delay_loop()
{
long i;
for(i=0 ; i<Delay_length ; i++){}
}
//============================================================================================
'삽질기초 > HW' 카테고리의 다른 글
Encoder Signal Generator - tms320f283335 (0) | 2012.04.12 |
---|---|
DSP library (0) | 2012.03.12 |
dsp-errer (0) | 2011.07.29 |
orcad layout 라우팅 문제 (0) | 2011.07.22 |
orcad - capture err (0) | 2011.07.14 |