C51 COMPILER V9.54   MAIN                                                                  05/09/2022 17:23:58 PAGE 1   


C51 COMPILER V9.54, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN .\Objects\main.obj
COMPILER INVOKED BY: C:\Keil_v5\C51\BIN\C51.EXE source\main.c OPTIMIZE(8,SPEED) BROWSE DEBUG OBJECTEXTEND PRINT(.\Listin
                    -gs\main.lst) TABS(2) OBJECT(.\Objects\main.obj)

line level    source

   1          /******************** (C) COPYRIGHT 2020 SONiX *******************************
   2          * COMPANY:  SONiX
   3          * DATE:     2022/04
   4          * AUTHOR:   Eden
   5          * IC:       
   6          * DESCRIPTION:
   7          *
   8          *   This sample code demonstrates how to use the UART function.
   9          *
  10          *____________________________________________________________________________
  11          * REVISION  Date        User  Description
  12          * 1.0       2022/04/28  Eden   First release
  13          *
  14          *____________________________________________________________________________
  15          * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  16          * WITH CODING INFORMATION REGARDING THEIR PRODUCTS TIME TO MARKET.
  17          * SONiX SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL 
  18          * DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH SOFTWARE
  19          * AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN 
  20          * IN CONNECTION WITH THEIR PRODUCTS.
  21          *****************************************************************************/
  22          #define __XRAM_SFR_H__
  23          /*_____ I N C L U D E S ____________________________________________________*/
  24          #include <SN8F5835.h>
  25          #include <stdlib.h>
  26          #include "uart.h"
  27          /*_____ D E F I N I T I O N S ______________________________________________*/
  28          
  29          /*_____ D E C L A R A T I O N S ____________________________________________*/
  30          uint8_t baryUSER_TxBuf[] = {0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7};
  31          uint8_t baryUSER_RxBuf[] = {0, 0, 0, 0, 0, 0, 0, 0};
  32          /*_____ F U N C T I O N S __________________________________________________*/
  33          void GPIO_Initialization(void);
  34            
  35          /*_____ M A C R O S _________________________________________________________*/
  36          #define IO_PORT0_OUTPUT_LOW   P0M |= 0xFF;  P0 &= 0x00;
  37          #define IO_PORT1_OUTPUT_LOW   P1M |= 0xFF;  P1 &= 0x00;
  38          #define IO_PORT3_OUTPUT_LOW   P3M |= 0xFF;  P3 &= 0x00;
  39          #define IO_PORT4_OUTPUT_LOW   P4M |= 0xFF;  P4 &= 0x00;
  40          
  41          /**
  42            * @brief  Main program: UART Demo Code. Connecting P11 to P07
  43            * @param  : None.
  44            * @retval : None.
  45            */
  46          int main(void)
  47          {
  48   1        GPIO_Initialization();
  49   1        EAL = 1;
  50   1      
  51   1        /*  UARTn_Init( (1) , (2) , (3) );
  52   1            (1) : "Baud rate selection"
  53   1            (2) : "RX mode: write RX Buf address" 
  54   1                  "TX mode: NULL"
C51 COMPILER V9.54   MAIN                                                                  05/09/2022 17:23:58 PAGE 2   

  55   1            (3) : "RX mode: write RX Buf length"  
  56   1                  "TX mode: NULL"                       */
  57   1        
  58   1        UART0_Init(eBAUD_RATE_19200, &baryUSER_RxBuf[0], sizeof(baryUSER_RxBuf));   /*  TX + RX */
  59   1        UART1_Init(eBAUD_RATE_19200, NULL, NULL);                                   /*  TX only */
  60   1        UART2_Init(eBAUD_RATE_19200, NULL, NULL);                                   /*  TX only */
  61   1        UART1_TransmitData(&baryUSER_TxBuf[0], sizeof(baryUSER_TxBuf));
  62   1        UART2_TransmitData(&baryUSER_TxBuf[0], sizeof(baryUSER_TxBuf));
  63   1        while(1)
  64   1        {
  65   2          if(UART0_ReceivedDone())
  66   2          {
  67   3            /* read uesr define RX buffer */
  68   3            if((baryUSER_RxBuf[0] == 0xA0) && (baryUSER_RxBuf[7] == 0xA7))
  69   3            {
  70   4              /* Return Data */
  71   4              baryUSER_TxBuf[0] = 0xB0;
  72   4              baryUSER_TxBuf[1] = 0xB1; 
  73   4              baryUSER_TxBuf[2] = 0xB2;
  74   4              baryUSER_TxBuf[3] = 0xB3; 
  75   4              baryUSER_TxBuf[4] = 0xB4;
  76   4              baryUSER_TxBuf[5] = 0xB5; 
  77   4              baryUSER_TxBuf[6] = 0xB6;
  78   4              baryUSER_TxBuf[7] = 0xB7;
  79   4        
  80   4              UART0_TransmitData(&baryUSER_TxBuf[0], sizeof(baryUSER_TxBuf)); 
  81   4            } 
  82   3          }
  83   2        }
  84   1      }
  85          
  86          /**
  87           *  @Brief    Initialize GPIO status
  88           *  @param    None
  89           *  @retval   None
  90           */
  91          void GPIO_Initialization(void)
  92          {
  93   1        /*  Set whole IOs to output low */
  94   1        IO_PORT0_OUTPUT_LOW
  95   1        IO_PORT1_OUTPUT_LOW
  96   1        IO_PORT3_OUTPUT_LOW
  97   1        IO_PORT4_OUTPUT_LOW
  98   1      }
  99          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    146    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     16    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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