C51 COMPILER V9.60.0.0   APP                                                               03/02/2021 17:33:02 PAGE 1   


C51 COMPILER V9.60.0.0, COMPILATION OF MODULE APP
OBJECT MODULE PLACED IN .\Out_Files\app.obj
COMPILER INVOKED BY: D:\keilc51\C51\BIN\C51.EXE APP\app.c COMPACT OMF2 OPTIMIZE(9,SIZE) BROWSE MOD517(NOAU) INCDIR(.\APP
                    -;.\Common;.\UM800x\driver;.\UM800x\system) DEBUG PRINT(.\Out_Files\app.lst) OBJECT(.\Out_Files\app.obj)

line level    source

   1          /***********************************************************************
   2           * Copyright (c)  2017 - 2020, Unicmicro Co.,Ltd .
   3           * All rights reserved.
   4           * Filename    : app.c
   5           * Description : app driver source file
   6           * Author(s)   : wanyi
   7           * version     : V1.0
   8           * Modify date : 2020-07-27
   9           ***********************************************************************/
  10          #include  "system_um800x.h"
  11          #include  "app.h"
  12          #include  "config.h"
  13          #include  "common.h"
  14          #include  "uart0.h"
  15          #include  "spi.h"
  16          
  17          volatile uint8_t rx_flag ;
  18          volatile uint8_t uart0_rx_buf[32];
  19          volatile uint8_t uart0_tx_buf[32];
  20          volatile uint16_t rx_count = 0;
  21          volatile uint16_t tx_count = 0;
  22          
  23          volatile uint8_t spi_rx_data;
  24          volatile uint8_t spi_rx_flag = 0;
  25          
  26          uint8_t xdata rx_buf[256];
  27          uint8_t xdata tx_buf[256];
  28          /************************************************************************
  29           * function   : uart0_rec_pro
  30           * Description: uart0_rec_pro 串口接收处理回调函数
  31           * input : none
  32           * return: none
  33           ************************************************************************/
  34          void uart0_rec_pro(void)
  35          {
  36   1              uart0_rx_buf[rx_count++]= uart0_recv_byte();
  37   1              rx_flag = 1;    
  38   1      }
  39          /************************************************************************
  40           * function   : uart0_send_pro
  41           * Description: uart0_send_pro 串口发送处理回调函数
  42           * input : none
  43           * return: none
  44           ************************************************************************/
  45          void uart0_send_pro(void)
  46          {
  47   1              tx_flag = 1;
  48   1      }
  49          
  50          /************************************************************************
  51           * function   : uart_init
  52           * Description: uart_init 串口初始化
  53           * input : none
  54           * return: none
C51 COMPILER V9.60.0.0   APP                                                               03/02/2021 17:33:02 PAGE 2   

  55           ************************************************************************/
  56          void uart_init(void)
  57          {
  58   1              rx_flag = 0;
  59   1              uart0_init(UART0_BAUD_RATE);
  60   1          uart0_irq_init(UART0_IRQ_ENABLE,uart0_rec_pro,uart0_send_pro);
  61   1      }
  62          
  63          void spi_irq_func(void)
  64          {
  65   1              spi_rx_data = spi_receive_byte();
  66   1              spi_rx_flag = 1;
  67   1      }
  68          
  69          void spi_test(void)
  70          {
  71   1                      uint16_t xdata i;
  72   1      
  73   1                      for(i=0;i<LEN;i++)
  74   1                      {
  75   2                              tx_buf[i]= i+0xA0;
  76   2                      }               
  77   1                      
  78   1                      printfS("SPI Slave test start!! \r\n");
  79   1                      spi_slave_init(WORK_MODE_0);
  80   1      
  81   1      #ifdef SPI_IRQ_ENABLE                                                                   //中断方式，在app.h中开启,从机中断接收注意SPI通讯速率快慢
                              printfS("SPI Slave RXNE irq test start!! \r\n");
                              spi_irq_enable(SPI_RXNE_IE,spi_irq_func);       
                              while(1)
                              {
                                                      
                                      for(i=0;i<LEN;i++)
                                      {               
                                                      spi_send_byte(tx_buf[i]);       
                                                      while(!spi_rx_flag);
                                                      rx_buf[i] = spi_rx_data;
                                                      spi_rx_flag = 0;                
                                      
                                      }
                                      printfB8(rx_buf,LEN);   
              
                              }
                              
                              
              #else                                                                                           //查询方式      
 101   1                      while(1)
 102   1                      {
 103   2                              for(i=0;i<LEN;i++)
 104   2                              {               
 105   3                                      spi_send_byte(tx_buf[i]);                                                
 106   3                                      rx_buf[i] = spi_receive_byte(); 
 107   3                                              
 108   3                              }
 109   2                              printfB8(rx_buf,LEN);   
 110   2                      }
 111   1      
 112   1      #endif
 113   1                                              
 114   1      }
 115          

C51 COMPILER V9.60.0.0   APP                                                               03/02/2021 17:33:02 PAGE 3   


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    229    ----
   CONSTANT SIZE    =     26    ----
   XDATA SIZE       =    512       2
   PDATA SIZE       =     71    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
   EDATA SIZE       =   ----    ----
   HDATA SIZE       =   ----    ----
   XDATA CONST SIZE =   ----    ----
   FAR CONST SIZE   =   ----    ----
END OF MODULE INFORMATION.


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