📄 p3.c
字号:
// Program for the switching of the Relays with the Buzzer.
// Connect 12v 2 pin connector with JP30 in Relay section.
//connect P0.24 - P0.31 with the Relay buzzer connector.
#include <LPC210x.h>
#define PLOCK 0x0400
#define TIME 3500000
unsigned long b;
void Init(void);
void Delay (unsigned long a);
unsigned char i;
unsigned long a[10]={0x00000FBF,0x00000F86,0x00000Fdb,0x00000Fcf,0x00000Fe6,0x00000Fed,0x00000Ffd,0x00000F87,0x00000Fff,0x00000Fef};
//---------------------------------------------------------
// System initializations
//---------------------------------------------------------
void Init() {
// Init PLL
PLLCFG=0x23; // P=2, M=4, PLLfreq = 235,9296 Mhz, CCLK = 58,9824 Mhz
PLLFEED=0xAA; PLLFEED=0x55;
PLLCON=0x1; // Enable the PLL
PLLFEED=0xAA; PLLFEED=0x55;
while(!(PLLSTAT & PLOCK)); // Wait for PLL to lock
PLLCON=0x3; // Connect PLL as clock source
PLLFEED=0xAA; PLLFEED=0x55;
//Init MAM & Flash memory fetch
MAMCR=0x2; //mam = flash
MAMTIM=0x4;
VPBDIV=0x1; //pclk = cclk
//GPIO init
IODIR=0xFFFFFFFF; //P0.7 is output(LED)
}
void Delay (unsigned long a)
{
while (--a!=0);
}
int main()
{
Init();
while(1)
{
IOCLR = 0xFFFFFFFF;
Delay(TIME);
IOSET = 0x0A000000;
Delay(TIME);
IOCLR = 0xFFFFFFFF;
Delay(TIME);
IOSET = 0x0C000000;
Delay(TIME);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -