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

📄 old1700.lst

📁 ISD 语音芯片的驱动程序。 原有产品已经停产
💻 LST
字号:
C51 COMPILER V8.02   OLD1700                                                               11/11/2008 08:49:53 PAGE 1   


C51 COMPILER V8.02, COMPILATION OF MODULE OLD1700
OBJECT MODULE PLACED IN old1700.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE old1700.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          /*
   2          MCU: stc12c2052
   3          晶振:11.0592  
   4          
   5          */
   6          #include <reg52.h>                       
   7          #include <intrins.h>  
   8          #define uchar unsigned char 
   9          #define uint unsigned int
  10          
  11          sbit  P20 =P2^0;
  12          sbit  P21 =P2^1;
  13          
  14          uchar bdata SR0_L,SR0_H,SR1,APC_L,APC_H;
  15          uchar ID,APCL=0,APCH=0,ISDEvent=0;
  16          
  17          sbit INT_1700=SR0_L^4;
  18          sbit EOM=SR0_L^3;
  19          sbit PU_1700=SR0_L^2;
  20          sbit FULL=SR0_L^1;
  21          sbit CMD_ERR=SR0_L^0;  
  22          
  23          sbit REC_1700=SR1^3;
  24          sbit PLAY_1700=SR1^2;
  25          sbit ERASE_1700=SR1^1;
  26          sbit RDY=SR1^0;
  27          
  28          sbit SS = P1^2;
  29          sbit SCLK = P1^3;
  30          sbit MOSI = P1^4;
  31          sbit MISO = P1^5;
  32          
  33          uchar data databuf[3];
  34          uchar   databufpc=0,hasdata=0;
  35          
  36          void delay_50us(uint t)      
  37          {
  38   1              uchar j=0;
  39   1              while(t--)
  40   1              for(j=0;j<6;j++);       
  41   1      }
  42           
  43          
  44          
  45          void delay(uint msec)
  46          {
  47   1          for (msec; msec > 0; msec--)
  48   1          {
  49   2              delay_50us(20);
  50   2          }
  51   1      }
  52           
  53          uchar spio(uchar BUF_ISD) //shaoliang
  54          {
  55   1       uchar i,dat=BUF_ISD;
C51 COMPILER V8.02   OLD1700                                                               11/11/2008 08:49:53 PAGE 2   

  56   1       SCLK=1;
  57   1       SS=0;
  58   1       for(i=0;i<8;i++)
  59   1       {
  60   2               SCLK=0; 
  61   2               _nop_(); _nop_();_nop_(); _nop_(); _nop_();               
  62   2                if(dat&0X01)  MOSI=1;
  63   2                else                  MOSI=0;         
  64   2               dat>>=1;
  65   2               if(MISO)            
  66   2                  dat=(dat|0X80);                             
  67   2                SCLK=1;
  68   2                _nop_(); _nop_(); _nop_(); _nop_();_nop_();
  69   2       }
  70   1       MOSI=0; 
  71   1       return(dat);  
  72   1      }   
  73           void rdstatus()
  74          {
  75   1       spio(0x05);
  76   1       spio(0x00);
  77   1       spio(0x00);
  78   1       SS=1;
  79   1       //delay(100);               //延迟100ms
  80   1       SR0_L=spio(0x05);
  81   1       SR0_H=spio(0x00);
  82   1       SR1=spio(0x00);
  83   1      }  
  84          void clrint()
  85          {
  86   1              spio(0x04);             spio(0x00);             SS=1;   
  87   1      
  88   1      } 
  89           pu()            //power up
  90          {
  91   1         spio(0x01);          spio(0x00);             SS=1;  
  92   1          delay(120);  
  93   1      } 
  94          
  95          void pd()           //power down
  96          {
  97   1              spio(0x07);             spio(0x00);     SS=1;
  98   1              delay(100);
  99   1      }  
 100          
 101          void reset()
 102          {
 103   1              spio(0x03);             spio(0x00);     SS=1;
 104   1              delay(100);
 105   1      } 
 106           
 107          void chk_mem()
 108          {
 109   1              spio(0x49);             spio(0x00);             SS=1;    delay(150);
 110   1      }
 111          
 112          void stop()
 113          {
 114   1              spio(0x02);spio(0x00); SS=1;
 115   1      }
 116          
 117          void wr_apc1()          //线路输入, aux 输出
C51 COMPILER V8.02   OLD1700                                                               11/11/2008 08:49:53 PAGE 3   

 118          {
 119   1      //      spio(0x45);     spio(0xc0);             spio(0x04);             // d7:d0   d11:d8       aux输出
 120   1               //     spio(0x45);     spio(0x40);             spio(0x04);       //aud电流输出    音量最大
 121   1                      spio(0x45);     spio(0x46);             spio(0x04);       //aud电流输出    第二个字节的低3位控制音量
 122   1      
 123   1              SS=1;  delay(1) ;
 124   1      }
 125          
 126          void wr_nvcfg()
 127          {
 128   1      
 129   1              spio(0x46);spio(0x00); SS=1;
 130   1      
 131   1      }
 132          
 133          void setplay(uchar segment)
 134          {
 135   1              stop();
 136   1              clrint();
 137   1              chk_mem();
 138   1              switch (segment)
 139   1          {
 140   2              case 0:         
 141   2                  spio(0x80);spio(0x00); spio(0x10);spio(0x00);spio(0x1a);spio(0x00);SS=1;
 142   2                  break;
 143   2              case 1:                   
 144   2                  spio(0x80);spio(0x00); spio(0x1b);spio(0x00);spio(0x27);spio(0x00);SS=1;
 145   2                  break;
 146   2              case 2:                 
 147   2                  spio(0x80);spio(0x00); spio(0x28);spio(0x00);spio(0x32);spio(0x00);SS=1;
 148   2                  break;
 149   2              case 3:                  
 150   2                  spio(0x80);spio(0x00); spio(0x33);spio(0x00);spio(0x3d/*0x3D*/);spio(0x00);SS=1;
 151   2                  break;
 152   2                      case 4:   
 153   2                  spio(0x80);spio(0x00); spio(0x3e);spio(0x00);spio(0x48);spio(0x00);SS=1;
 154   2                  break;
 155   2                      case 5:    
 156   2                  spio(0x80);spio(0x00); spio(0x49);spio(0x00);spio(0x53);spio(0x00);SS=1;
 157   2                  break;
 158   2                      case 6:                
 159   2                  spio(0x80);spio(0x00); spio(0x54);spio(0x00);spio(0x5D);spio(0x00);SS=1;
 160   2                  break;
 161   2                      case 7:                 
 162   2                  spio(0x80);spio(0x00); spio(0x5E);spio(0x00);spio(0x67);spio(0x00);SS=1;
 163   2                  break;
 164   2                      case 8:                   
 165   2                  spio(0x80);spio(0x00); spio(0x68);spio(0x00);spio(0x6a);spio(0x00);SS=1;
 166   2                      case 9:                     
 167   2                  spio(0x80);spio(0x00); spio(0x72);spio(0x00);spio(0x76);spio(0x00);SS=1;
 168   2                  break;
 169   2      
 170   2                 case 10:             
 171   2                  spio(0x80);spio(0x00); spio(0x77);spio(0x00);spio(0x7b);spio(0x00);SS=1;
 172   2                  break;
 173   2              default:
 174   2                               //spio(0x80);spio(0x00); spio(0x10);spio(0x00);spio(0x2a);spio(0x00);SS=1;
 175   2                  break;
 176   2          }
 177   1      }       
 178          
 179          initisd1700()
C51 COMPILER V8.02   OLD1700                                                               11/11/2008 08:49:53 PAGE 4   

 180          {
 181   1      dd: pu();   //上电       
 182   1              
 183   1              rdstatus();  
 184   1              
 185   1              if((PU_1700==0||CMD_ERR==1) &&ISDEvent<10)
 186   1              {                       
 187   2                       ISDEvent++;                                             
 188   2                       reset(); 
 189   2                       pd();                  
 190   2                       goto dd;                          
 191   2              }
 192   1              if(     ISDEvent==10) 
 193   1              {
 194   2                      ISDEvent=0;
 195   2                      return;
 196   2              }
 197   1               chk_mem();
 198   1           wr_apc1();
 199   1           wr_nvcfg();           
 200   1      
 201   1      }
 202          
 203          
 204          uchar yuyin_play(uchar i)
 205          {
 206   1                   
 207   1                        stop();
 208   1               aa:  clrint(); 
 209   1                        chk_mem(); 
 210   1                        setplay(i);
 211   1                                                      
 212   1                       rdstatus(); 
 213   1                              
 214   1                       if(CMD_ERR==1) 
 215   1                       {
 216   2                               clrint();       
 217   2                               goto aa; 
 218   2                       }      
 219   1                   _nop_();
 220   1                   _nop_();
 221   1                   _nop_();
 222   1                                 
 223   1                       return 1;
 224   1      }
 225          
 226          void Timer0_ISR(void)interrupt 1
 227          {
 228   1          databufpc = 0;
 229   1          ET0 = 0;
 230   1          TR0 = 0;
 231   1      }
 232            
 233           main()
 234           {
 235   1              uchar tmp;
 236   1              TMOD=0x21;
 237   1              TL1=0xfd;TH1=0xfd;                 //波特率9600 8数据 1停止
 238   1              SCON=0xd8;
 239   1              PCON &= 0x7f;
 240   1              IE=0X96; 
 241   1              TR1=1;   
C51 COMPILER V8.02   OLD1700                                                               11/11/2008 08:49:53 PAGE 5   

 242   1              EA=1;
 243   1              ES = 0;
 244   1          REN = 1;
 245   1          RI = 0;
 246   1               
 247   1              MOSI=0; 
 248   1              hasdata=0;                
 249   1              
 250   1              SBUF=0x55;while(TI==0); TI=0;
 251   1                                       
 252   1              initisd1700();
 253   1      
 254   1              SBUF=0xAA;while(TI==0); TI=0;
 255   1      
 256   1      
 257   1              delay(50);
 258   1              yuyin_play(2);
 259   1              while(1)
 260   1              {  /*
 261   2                      if(hasdata==1)
 262   2                      {
 263   2                              SBUF=databuf[0];while(TI==0);   TI=0;
 264   2                              SBUF=databuf[1];while(TI==0);   TI=0;
 265   2                              SBUF=databuf[2];while(TI==0);   TI=0;
 266   2                              hasdata=0;      
 267   2                              if(databuf[0]==0x55)
 268   2                              {
 269   2                                      yuyin_play(databuf[1]);
 270   2                                      databufpc=0;
 271   2                                      SBUF=0x88;while(TI==0); TI=0;
 272   2                              }
 273   2      
 274   2                      }
 275   2                      */
 276   2      
 277   2                      if(RI==1)
 278   2                      {
 279   3                              RI=0;
 280   3                              tmp=SBUF;
 281   3                              if(tmp>=0x80||tmp<=0x86)
 282   3                              {                                                                                               
 283   4                                      yuyin_play(tmp-0x80);
 284   4                              }
 285   3                      }
 286   2              
 287   2              }
 288   1       }


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


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

⌨️ 快捷键说明

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