📄 ad_paoma_beep.txt
字号:
#include "lpc214x.h"
#include "config.h"
#define BEEP 1<<24 //p1.24
const uint32 LEDS3=(0x07<<28);
void Delay(uint32 dly)
{
uint32 i;
for(;dly>0;dly--)
for(i=0;i<50000;i++);
}
int main(void)
{ uint32 ADC_Data;
uint8 i;
// PINSEL0=0x0F333F00;
// PINSEL1=0x15541800;
IO1DIR|=BEEP;
IO1SET=BEEP;
IO0DIR=BEEP;
PINSEL1|=1<<18; //p0.25连接到ad0.4
AD0CR=(1<<4)| //选择AD0.4
((Fpclk/100000-1)<<8)| //CLKDIV=Fpclk/1000000-1,conver 1MHz
(0<<16)| //burst=0 软件控制转化
(0<<17)| //11clock
(1<<21)| //PDN=1,正常工作模式
(0<<22)| //TEST1:0 = 00
(1<<24)| //start=0 ad conversion stops
(0<<27); //EDGE=0(cap/mat )
Delay(10);
ADC_Data=AD0DR;
IO0DIR=LEDS3;
while(1)
{
for(i=0;i<3;i++)
{
IO0SET=~(LEDS3&(1<<(28+i)));
Delay(30);
IO0CLR=LEDS3&(1<<(28+i));
Delay(30);
IO1CLR=BEEP;
Delay(5);
IO1SET=BEEP;
Delay(5);
}
}
/* while(1)
{
IO1SET=BEEP;
Delay(6);
// IO1CLR=BEEP; //xiang
Delay(6);
}
return 0;
*/
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -