📄 registers.c
字号:
// Register initialization required to support the MCB2130 board and the wheather station
#include <LPC213x.H> // LPC21xx definitions
// UART 1 Tx and Rx pin assignment, AD1 and DAC assignments
void init_registers() {
// Pin Select register 0
PINSEL0 = 0x00050020; // Enable RxD1 and TxD1 on pins P0.8 & P0.9
// Enable Cap 1.0 on pins P0.10 & Cap 1.1 on pin P0.11
// the 20 is for pin 2 as timer 0 capture 0.0
// setup IO pin directions for outputs
IODIR1 = 0x00FF0000; // P1.16..23 defined as Outputs
// Setup A/D
// AD0CR = 0x00200402; // Setup A/D: 10-bit AIN0 (ch 0 and 1) @ 3MHz
PINSEL1 = 0x01400000; // enable DAC was 0x01080000
// was changed to 0x01000000 to disable DAC
// chanded to 0x01400000 enable A/D ch 0 & 1
// enable interrupts // currectly DAC is disabled, hence PINSEL1 = 0x01000000
// Default for GPIO P0.16..18 are used for position
VICIntEnable = 0x000020B0; // Enable Timer0 (0x00000010),
// Timer 1 (0x00000020),
// UART 1 (0x00000080),
// and RTC Interrupt (0x00002000)
}
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -