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

📄 voice.lst

📁 这是广西大学生设计大赛的源码
💻 LST
字号:
C51 COMPILER V8.02   VOICE                                                                 04/26/2008 23:15:58 PAGE 1   


C51 COMPILER V8.02, COMPILATION OF MODULE VOICE
OBJECT MODULE PLACED IN voice.OBJ
COMPILER INVOKED BY: D:\Keil1\C51\BIN\C51.EXE voice.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          
   2          #include "voice.h"
   3          #include "datetime.h"
   4          #include "lcd.h"
   5          #include <REGX51.H>
   6          
   7           
   8          
   9          
  10          #define VOC P2
  11          
  12           
  13          
  14          
  15          BIT voc_SendBit7;
  16          BIT voc_IsAlarming;
  17          
  18           
  19          
  20          void vocInit(void)
  21          {
  22   1       VOC = 0;
  23   1       voc_IsAlarming = FALSE;
  24   1      }
  25          
  26          
  27          void vocSendByte(BYTE b)
  28          {
  29   1       voc_SendBit7 = ~voc_SendBit7;
  30   1      
  31   1       if (voc_SendBit7) b&=0x7f;
  32   1       else b|=0x80;
  33   1      
  34   1       VOC = b;
  35   1       DelayX1ms(5);
  36   1      }
  37          
  38          
  39          void vocSendString(char* str)
  40          {
  41   1       BYTE i = 0;
  42   1      
  43   1       while (i<255)
  44   1       {
  45   2        if (str[i]==0) break;
  46   2        vocSendByte(str[i]);
  47   2        i++;
  48   2       }
  49   1      }
  50          
  51          
  52          void vocSendNumberChar(BYTE num)
  53          {
  54   1       if (num < 10) vocSendByte(num+'0');
  55   1      }
C51 COMPILER V8.02   VOICE                                                                 04/26/2008 23:15:58 PAGE 2   

  56          
  57          
  58          void vocSendUInt(BYTE a)
  59          {
  60   1       BYTE x100,x10,x1;
  61   1       x100 = a / 100;
  62   1       x10 = (a % 100) / 10;
  63   1       x1 = a % 10;
  64   1      
  65   1       if (x100)
  66   1       {
  67   2        vocSendNumberChar(x100);
  68   2        vocSendString("H");
  69   2       }
  70   1      
  71   1       if (x10)
  72   1       {
  73   2        vocSendNumberChar(x10);
  74   2        vocSendString("X");
  75   2       }
  76   1       else
  77   1       {
  78   2        if (x100 && x1) vocSendNumberChar(0);
  79   2       }
  80   1      
  81   1       if (x1)
  82   1       {
  83   2        vocSendNumberChar(x1);
  84   2       }
  85   1       else
  86   1       {
  87   2        if (a==0) vocSendNumberChar(0);
  88   2       }
  89   1      }
  90          
  91          
  92          BIT vocIsAlarming(void)
  93          {
  94   1       return voc_IsAlarming;
  95   1      }
  96          
  97          
  98          void vocStopAll(void)
  99          {
 100   1       vocSendByte(0);
 101   1       voc_IsAlarming = FALSE;
 102   1      }
 103          
 104          
 105          void vocAlarm(void)
 106          {
 107   1       if ( !voc_IsAlarming )
 108   1       {
 109   2        vocSendByte('A');
 110   2        voc_IsAlarming = TRUE;
 111   2       }
 112   1      }
 113          
 114          
 115          void vocTime(void)
 116          {
 117   1       DATETIME dtt;
C51 COMPILER V8.02   VOICE                                                                 04/26/2008 23:15:58 PAGE 3   

 118   1      
 119   1       vocSendString("XI");
 120   1       dtt = dttGetCurDateTime();
 121   1      
 122   1       //hour
 123   1       vocSendUInt( dtt.hh );
 124   1       vocSendString(".");
 125   1      
 126   1       //minute
 127   1       vocSendUInt( dtt.mi );
 128   1       vocSendString("M");
 129   1      
 130   1       //second
 131   1       vocSendUInt( dtt.ss );
 132   1       vocSendString("S");
 133   1      }
 134          
 135          
 136          void vocTempe(TEMPE * pT, BIT bConvertToF)
 137          {
 138   1       TEMPE tempe;
 139   1       BYTE m,n;
 140   1             // 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
 141   1       const BYTE code div[] = {  00,  06,  13,  19,  25,  31,  38,  44,  50,  56,  63,  69,  75,  81,  88,  94,
             - };
 142   1      // const BYTE -div[]     = {  94, 88,  81,  75,  69, 63,  56,  50,  44, 38,  31,  25,  19, 16,  06,  00, }
             -; //正的倒序
 143   1      
 144   1       tempe = *pT;
 145   1      
 146   1       if (bConvertToF) ConvertCtoF(pT);
 147   1       vocSendString("TD");
 148   1      
 149   1       m = ((pT->th << 4) & 0xf0) | ((pT->tl >> 4) & 0x0f);
 150   1       if (pT->th & 0x80)
 151   1       {
 152   2        vocSendString("-");
 153   2        m = ~m;
 154   2        n = div[(16 - pT->tl) & 0x0f];
 155   2       }
 156   1       else
 157   1       {
 158   2        n = div[pT->tl & 0x0f];
 159   2       }
 160   1      
 161   1       vocSendUInt(m);
 162   1       vocSendString(".");
 163   1       vocSendNumberChar( n/10 );
 164   1       vocSendNumberChar( n%10 );
 165   1       vocSendString( bConvertToF ? "FND" : "CND" );
 166   1      
 167   1       *pT = tempe;
 168   1      }
 169          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    473    ----
   CONSTANT SIZE    =     42    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----      21
C51 COMPILER V8.02   VOICE                                                                 04/26/2008 23:15:58 PAGE 4   

   IDATA SIZE       =   ----    ----
   BIT SIZE         =      2       1
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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