⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pcc.lst

📁 STC51系列的源码
💻 LST
字号:
C51 COMPILER V8.12   PCC                                                                   12/03/2008 09:22:32 PAGE 1   


C51 COMPILER V8.12, COMPILATION OF MODULE PCC
OBJECT MODULE PLACED IN .\PCC.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ..\PCC\PCC.c LARGE BROWSE DEBUG OBJECTEXTEND PRINT(.\PCC.lst) OBJECT(.\PCC.
                    -obj)

line level    source

   1          /********************************************************************************/
   2          /* filename : PCC.c                                                             */
   3          /* created  : xillinx                                                           */
   4          /* descript : 与计算机通讯的定义和处理                                          */
   5          /********************************************************************************/
   6          #include "../CPU/CPU.h"
   7          #include "../CFG/CFG.h"
   8          #include "../UART/UART.h"
   9          #include "../PCC/PCC.h"
  10          
  11          
  12          pcc_hook_function pcc_hook_process=PCC_hook_null;
  13          unsigned char pcc_mdata[0x20];
  14          unsigned char pcc_len;
  15          
  16          /********************************************************************************/
  17          /* function : PCC_send_mdata()                                                  */
  18          /* created  : hw-chen                                                           */
  19          /* descript : 通过UART向计算机方式数据                                          */
  20          /********************************************************************************/
  21          void PCC_hook_null(unsigned char * mdata, unsigned char length)
  22          {   mdata =mdata;
  23   1          length=length;
  24   1      }
  25          
  26          /********************************************************************************/
  27          /* function : PCC_send_mdata()                                                  */
  28          /* created  : hw-chen                                                           */
  29          /* descript : 通过UART向计算机方式数据                                          */
  30          /********************************************************************************/
  31          unsigned char PCC_send_mdata(unsigned char type, unsigned char * mdata, unsigned char length)
  32          {   unsigned char i;
  33   1          ES=0x0;
  34   1          
  35   1          if(((uart_xmit_wr+0x1)&UART_SEND_BUF_MSK)==uart_xmit_rd) //* 缓冲区已经满了
  36   1          {  goto out_proc;
  37   2          }
  38   1          UART_send_buffer[uart_xmit_wr]=0xFE;
  39   1          uart_xmit_wr++;
  40   1          uart_xmit_wr&=UART_SEND_BUF_MSK;
  41   1          
  42   1          if(((uart_xmit_wr+0x1)&UART_SEND_BUF_MSK)==uart_xmit_rd) //* 缓冲区已经满了
  43   1          {  goto out_proc;
  44   2          }
  45   1          UART_send_buffer[uart_xmit_wr]=type;
  46   1          uart_xmit_wr++;
  47   1          uart_xmit_wr&=UART_SEND_BUF_MSK;
  48   1          
  49   1          for(i=0x0;i<length;i++)
  50   1          {  switch(mdata[i])
  51   2             {
  52   3             case 0xFF:
  53   3                  if(((uart_xmit_wr+0x1)&UART_SEND_BUF_MSK)==uart_xmit_rd) //* 缓冲区已经满了
  54   3                  {  goto out_proc;
C51 COMPILER V8.12   PCC                                                                   12/03/2008 09:22:32 PAGE 2   

  55   4                  }
  56   3                  UART_send_buffer[uart_xmit_wr]=0xFD;
  57   3                  uart_xmit_wr++;
  58   3                  uart_xmit_wr&=UART_SEND_BUF_MSK;
  59   3                  
  60   3                  if(((uart_xmit_wr+0x1)&UART_SEND_BUF_MSK)==uart_xmit_rd)
  61   3                  {  goto out_proc;
  62   4                  }
  63   3                  UART_send_buffer[uart_xmit_wr]=0x2;
  64   3                  uart_xmit_wr++;
  65   3                  uart_xmit_wr&=UART_SEND_BUF_MSK;
  66   3                  break;
  67   3             case 0xFE:
  68   3                  if(((uart_xmit_wr+0x1)&UART_SEND_BUF_MSK)==uart_xmit_rd)
  69   3                  {  goto out_proc;
  70   4                  }
  71   3                  UART_send_buffer[uart_xmit_wr]=0xFD;
  72   3                  uart_xmit_wr++;
  73   3                  uart_xmit_wr&=UART_SEND_BUF_MSK;
  74   3                  
  75   3                  if(((uart_xmit_wr+0x1)&UART_SEND_BUF_MSK)==uart_xmit_rd)
  76   3                  {  goto out_proc;
  77   4                  }
  78   3                  UART_send_buffer[uart_xmit_wr]=0x1;
  79   3                  uart_xmit_wr++;
  80   3                  uart_xmit_wr&=UART_SEND_BUF_MSK;
  81   3                  break;
  82   3             case 0xFD:
  83   3                  if(((uart_xmit_wr+0x1)&UART_SEND_BUF_MSK)==uart_xmit_rd)
  84   3                  {  goto out_proc;
  85   4                  }
  86   3                  UART_send_buffer[uart_xmit_wr]=0xFD;
  87   3                  uart_xmit_wr++;
  88   3                  uart_xmit_wr&=UART_SEND_BUF_MSK;
  89   3                  
  90   3                  if(((uart_xmit_wr+0x1)&UART_SEND_BUF_MSK)==uart_xmit_rd)
  91   3                  {  goto out_proc;
  92   4                  }
  93   3                  UART_send_buffer[uart_xmit_wr]=0x0;
  94   3                  uart_xmit_wr++;
  95   3                  uart_xmit_wr&=UART_SEND_BUF_MSK;
  96   3                  break;
  97   3             default:
  98   3                  if(((uart_xmit_wr+0x1)&UART_SEND_BUF_MSK)==uart_xmit_rd)
  99   3                  {  goto out_proc;
 100   4                  }
 101   3                  UART_send_buffer[uart_xmit_wr]=mdata[i];
 102   3                  uart_xmit_wr++;
 103   3                  uart_xmit_wr&=UART_SEND_BUF_MSK;
 104   3                  break;
 105   3             }
 106   2          }
 107   1          if(((uart_xmit_wr+0x1)&UART_SEND_BUF_MSK)==uart_xmit_rd) //* 缓冲区已经满了
 108   1          {  goto out_proc;
 109   2          }
 110   1          UART_send_buffer[uart_xmit_wr]=0xFF;
 111   1          uart_xmit_wr++;
 112   1          uart_xmit_wr&=UART_SEND_BUF_MSK;
 113   1      out_proc:  
 114   1          if(uart_xmit_start==0x0)    //* 如果需要启动发生,就启动
 115   1          {  uart_xmit_start=0x1;
 116   2             TI=1;
C51 COMPILER V8.12   PCC                                                                   12/03/2008 09:22:32 PAGE 3   

 117   2             ES=0x1;
 118   2          }
 119   1          else
 120   1          {  ES=0x1;
 121   2          }
 122   1          return i;
 123   1      }
 124          
 125          
 126          /********************************************************************************/
 127          /* function : PCC_recv_mdata()                                                  */
 128          /* created  : hw-chen                                                           */
 129          /* descript : 接收处理计算机发送过来的数据                                      */
 130          /********************************************************************************/
 131          void PCC_recv_mdata(void)
 132          {   if(uart_recv_start==0x0)
 133   1          {  return;
 134   2          }
 135   1          uart_recv_start=0x0;
 136   1          pcc_len=0x0;
 137   1          while(uart_recv_rd!=uart_recv_wr)   //* 处理头部,如果第一字节不为0xFE头,丢弃数据,直到找到头部或者数据

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -