hello.c

来自「protues 仿真 UART发送hello,很好的软件」· C语言 代码 · 共 22 行

C
22
字号
#include <REG51.H>              /* special function register declarations   */
                                /* for the intended 8051 derivative         */
#include <stdio.h>              /* prototype declarations for I/O functions */

void main (void)
 {
    SCON  = 0x50;		        /* SCON: mode 1, 8-bit UART, enable rcvr      */
    TMOD  = 0x20;               /* TMOD: timer 1, mode 2, 8-bit reload        */

    TH1   = 0xFD;               /* TH1:  reload value for 9600 baud @ 11.0592MHz */
    TL1   = 0xFD;
    TR1   = 1;                  /* TR1:  timer 1 run                          */
    TI    = 1;                  /* TI:   set TI to send first char of UART    */

  while (1) 
   {
    printf ("Hello World\n");   /* Print "Hello World" */
   }
}


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?