C51 COMPILER V7.09   MAIN                                                                  06/15/2006 17:47:46 PAGE 1   


C51 COMPILER V7.09, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE main.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          /*
   2          *********************************************************************************************************
   3          *                                                                       UART DEMONSTRATION PROGRAM
   4          *
   5          * File name             : main.c
   6          * Programmer    : John Leung, TechToys. Hong Kong
   7          * Web presence  : www.TechToys.com.hk
   8          * Note                  : 
   9          * Language              : Keil C 7.09 2K limited version under uVision2 IDE v2.40
  10          * Hardware              : AT89S52-gLCD-STK1
  11          * Version               : Version 1.0
  12          * Date                  : 6th June 2006
  13          *********************************************************************************************************
  14          *                                                                                       DESCRIPTION
  15          *
  16          * This program configures an AT89S52 mcu for RS232 communication with a PC.
  17          * Baud rate is 9600bps, Timer 1 is used as the baud rate generator
  18          * Standard library stdio.h is also included for printf function.
  19          * Dummy data temperature and humidity values are sent to a PC for debug purpose.
  20          *********************************************************************************************************
  21          */
  22          
  23          #include <REGX52.h>
  24          #include "delay.h"
  25          #include <stdio.h>
  26          
  27          unsigned char temperature;
  28          unsigned char humidity;
  29          
  30          /*
  31          *********************************************************************************************************
  32          *                                                               UART INITIALIZATION
  33          *
  34          * Description : This function initialize the UART port of 89S52. Timer 1 is used as the baud rate
  35          *                               generator with an external crystal frequency of 11.0592MHz onboard.
  36          *
  37          * Arguments   : none
  38          *                       
  39          * Returns     : none
  40          *********************************************************************************************************
  41          */
  42          void uartInit(void)
  43          {
  44   1              SCON  = 0x52;           //UART in 8 bit mode
  45   1              TMOD  = TMOD|0x20;  //Timer 1 configured for 8-bit auto-reload timer mode, Timer 0 unchanged
  46   1              TH1   = 0xfd;           //TH1 value for a baud rate 9600bps
  47   1              TR1   = 1;                      //Timer 1 is turned ON
  48   1      }
  49          
  50          
  51          /*
  52          *********************************************************************************************************
  53          *                                                               MAIN PROGRAM
  54          *********************************************************************************************************
  55          */
C51 COMPILER V7.09   MAIN                                                                  06/15/2006 17:47:46 PAGE 2   

  56          void main(void)
  57          {
  58   1              uartInit();
  59   1              for(;;)
  60   1              {
  61   2                      printf("Temperature : %bu  Humidity : %bu \n", temperature++, humidity++);
  62   2                      DelayMs(1000);
  63   2              }
  64   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =     45    ----
   CONSTANT SIZE    =     36    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      2    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)
