⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 Hitex LPC2100 insider guide source code
💻 C
字号:
#include <math.h>
#include <LPC213x.h>
unsigned int input[50];
unsigned int output[50]
unsigned int impulse[10]

void main(void)
{
unsigned int val;


PINSEL1 = 0x00080000;			//Configure pin 0.25 as the DAC pin
VPBDIV 	= 0x01;					//Set the Pclk to 60 Mhz
T0PR 	= 0x0000000;			//Load prescaler
T0TCR 	= 0x00000002;			//Reset counter and prescaler
T0MCR 	= 0x00000003;			//On match reset the counter and generate an interrupt
T0MR0	= 0x00000668;			//Set the cycle time
T0MR1	= 0x0000000c;			// Set 50% duty cycle
T0EMR  	= 0x00000042;			//On match clear MAT1
T0TCR 	= 0x00000001;

AD0CR   = 0x00270601;    			// Setup A/D: 10-bit AIN0 @ 3MHz 
AD0CR  |= 0x01000000;    			// Start A/D Conversion 

while(1)
{
		  
do
{
    val = AD0DR;                   // Read A/D Data Register 
}        
while ((val & 0x80000000) == 0);  //Wait for the conversion to complete

DACR   = val;					  //Write the converted value to the DAC register
}
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -