?? main.c
字號:
#include "myapp.h"
#include "ICETEK-VC5509-EDU.h"
#include "scancode.h"
void InitADC();
void wait( unsigned int cycles );
void EnableAPLL( );
unsigned int nADC0[256],nADC1[256];
main()
{
int i;
unsigned int uWork;
EnableAPLL();
SDRAM_init();
InitADC();
PLL_Init(132);
while ( 1 )
{
for ( i=0;i<256;i++ )
{
ADCCTL=0x8000; // 啟動AD轉換,通道0
do
{
uWork=ADCDATA;
} while ( uWork&0x8000 );
nADC0[i]=uWork&0x0fff;
}
for ( i=0;i<256;i++ )
{
ADCCTL=0x9000; // 啟動AD轉換,通道1
do
{
uWork=ADCDATA;
} while ( uWork&0x8000 );
nADC1[i]=uWork&0x0fff;
}
asm( " nop"); // break point
}
}
void InitADC()
{
ADCCLKCTL=0x23; // 4MHz ADCLK
ADCCLKDIV=0x4f00;
}
void wait( unsigned int cycles )
{
int i;
for ( i = 0 ; i < cycles ; i++ ){ }
}
void EnableAPLL( )
{
/* Enusre DPLL is running */
*( ioport volatile unsigned short* )0x1f00 = 4;
wait( 25 );
*( ioport volatile unsigned short* )0x1f00 = 0;
// MULITPLY
*( ioport volatile unsigned short* )0x1f00 = 0x3000;
// COUNT
*( ioport volatile unsigned short* )0x1f00 |= 0x4F8;
wait( 25 );
//*( ioport volatile unsigned short* )0x1f00 |= 0x800
// MODE
*( ioport volatile unsigned short* )0x1f00 |= 2;
wait( 30000 );
// APLL Select
*( ioport volatile unsigned short* )0x1e80 = 1;
// DELAY
wait( 60000 );
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -