📄 testmcu.c
字号:
void SYSCLK_Init (void)
{
int i; // delay counter
OSCXCN = 0x67; // start external oscillator with
// 22.1184MHz crystal
for (i=0; i < 256; i++) ; // XTLVLD blanking interval (>1ms)
while (!(OSCXCN & 0x80)) ; // Wait for crystal osc. to settle
OSCICN = 0x88; // select external oscillator as SYSCLK
// source and enable missing clock
// detector
}
WDTCN = 0x07; // Watchdog Timer Control Register
WDTCN = 0xDE; // Disable WDT
WDTCN = 0xAD;
XBR0 = 0x04; // XBAR0: Initial Reset Value
XBR1 = 0x2A; // XBAR1: Initial Reset Value
XBR2 = 0x44; // XBAR2: Initial Reset Value
P0MDOUT = 0x05; // Output configuration for P0
P1MDOUT = 0x00; // Output configuration for P1
P2MDOUT = 0x00; // Output configuration for P2
P3MDOUT = 0x00; // Output configuration for P3
P74OUT = 0x00; // Output configuration for P4-7
P1MDIN = 0xFF; // Input configuration for P1
// View port pinout
// The current Crossbar configuration results in the
// following port pinout assignment:
// Port 0
// P0.0 = UART TX0 (Push-Pull Output)
// P0.1 = UART RX0 (Open-Drain Output/Input)
// P0.2 = UART TX1 (Push-Pull Output)
// P0.3 = UART RX1 (Open-Drain Output/Input)
// P0.4 = T0 (Open-Drain Output/Input)
// P0.5 = T1 (Open-Drain Output/Input)
// P0.6 = T2 (Open-Drain Output/Input)
// P0.7 = GP I/O (Open-Drain Output/Input)
OSCXCN = 0x01; // EXTERNAL Oscillator Control Register
OSCICN = 0x04; // Internal Oscillator Control Register
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -