ex1c.c
来自「基于单片机、nrf24e1发射接受程序」· C语言 代码 · 共 57 行
C
57 行
/*= ex1c.c =====================================================================
*
* Copyright (C) 2003 Nordic VLSI ASA
*
* Author(s) : Ole Saether
* Support mail : nrfprog@nvlsi.no
*
* DESCRIPTION:
*
* Hello World program.
*
* The functionality is the same as in ex1a.asm.
*
* COMPILER:
*
* This program has been tested with Keil C51 V6.10 and V7.05.
*
* $Revision: 1 $
*
*==============================================================================
*/
#include <Nordic VLSI\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
TCON = 0x40; // Start timer1
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 + =
减小字号Ctrl + -
显示快捷键?