?? ex1c.c
字號:
/*= ex1c.c =====================================================================
*
* Copyright (C) 2003, 2004 Nordic Semiconductor
*
* This file is distributed in the hope that it will be useful, but WITHOUT
* WARRANTY OF ANY KIND.
*
* Author(s): Ole Saether
*
* DESCRIPTION:
*
* Hello World program.
*
* The functionality is the same as in ex1a.asm.
*
* COMPILER:
*
* This program has been tested with Keil V7.07a.
*
* $Revision: 5 $
*
*==============================================================================
*/
#include <Nordic\reg24e1.h>
void Init(void)
{
TH1 = 243; // 19200@16MHz (when T1M=1 and SMOD=1)
CKCON |= 0x10; // T1M=1 (/4 timer clock)
PCON = 0x80; // SMOD=1 (double baud rate)
SCON = 0x52; // Serial mode1, enable receiver
TMOD = 0x20; // Timer1 8bit auto reload
TR1 = 1; // Start timer1
P0_DIR |= 0x02; // P0.1 (RxD) is an input
P0_ALT |= 0x06; // Select alternate functions on pins P0.1 and P0.2
}
void PutChar(char c)
{
while(!TI)
;
TI = 0;
SBUF = c;
}
void PutString(const char *s)
{
while(*s != 0)
PutChar(*s++);
}
int main(void)
{
Init();
PutString("Hello World!\n");
for(;;)
;
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -