home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1996 September
/
PCWK996.iso
/
demo
/
wgelectr
/
pk51demo
/
files.2
/
EXAMPLES
/
HELLO
/
HELLO.C
< prev
next >
Wrap
C/C++ Source or Header
|
1995-09-26
|
2KB
|
36 lines
/*------------------------------------------------------------------------------
HELLO.C
Copyright 1995 KEIL Software, Inc.
------------------------------------------------------------------------------*/
#pragma DEBUG OBJECTEXTEND CODE /* gma lines can contain state C51 */
/* command line directives */
#include <reg51.h> /* special function register declarations */
/* the intended 8051 derivative */
#include <stdio.h> /* prototype declarations for I/O functions */
/****************/
/* main program */
/****************/
void main (void) { /* execution starts here after stack init */
/* do not initilize the serial interface if you are running with Monitor-51 */
#ifndef MON51
SCON = 0x50; /* SCON: mode 1, 8-bit UART, enable rcvr */
TMOD |= 0x20; /* TMOD: timer 1, mode 2, 8-bit reload */
TH1 = 0xf3; /* TH1: reload value for 2400 baud */
TR1 = 1; /* TR1: timer 1 run */
TI = 1; /* TI: set TI to send first char of UART */
#endif
printf ("Hello World\n"); /* the 'printf' function call */
while (1) { /* An embedded program does not stop and */
; /* ... */ /* never returns. We've used an endless */
} /* loop. You may wish to put in your own */
} /* code were we've printed the dots (...). */