0% found this document useful (0 votes)
12 views

Keil Atharv

kroil software
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Keil Atharv

kroil software
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

C:\Keil\C51\Examples\Hello\HELLO.

C
1 /*------------------------------------------------------------------------------
2 HELLO.C
3
4 Copyright 1995-2005 Keil Software, Inc.
5 ------------------------------------------------------------------------------*/
6
7 #include <REG52.H> /* special function register declarations */
8 /* for the intended 8051 derivative */
9
10 #include <stdio.h> /* prototype declarations for I/O functions */
11
12
13 #ifdef MONITOR51 /* Debugging with Monitor-51 needs */
14 char code reserve [3] _at_ 0x23; /* space for serial interrupt if */
15 #endif /* Stop Exection with Serial Intr. */
16 /* is enabled */
17
18
19 /*------------------------------------------------
20 The main C function. Program execution starts
21 here after stack initialization.
22 ------------------------------------------------*/
23 void main (void) {
24
25 /*------------------------------------------------
26 Setup the serial port for 1200 baud at 16MHz.
27 ------------------------------------------------*/
28 #ifndef MONITOR51
29 SCON = 0x50; /* SCON: mode 1, 8-bit UART, enable rcvr */
30 TMOD |= 0x20; /* TMOD: timer 1, mode 2, 8-bit reload */
31 TH1 = 221; /* TH1: reload value for 1200 baud @ 16MHz */
32 TR1 = 1; /* TR1: timer 1 run */
33 TI = 1; /* TI: set TI to send first char of UART */
34 #endif
35
36 /*------------------------------------------------
37 Note that an embedded program never exits (because
38 there is no operating system to return to). It
39 must loop and execute forever.
40 ------------------------------------------------*/
41 while (1) {
42 P1 ^= 0x01; /* Toggle P1.0 each time we print */
43 printf ("Hello World\n"); /* Print "Hello World" */
44
45 }
46
47
48

Page 1

You might also like