depression.txt

来自「数据压缩算法程序代码」· 文本 代码 · 共 85 行

TXT
85
字号
void TXalgorithm(void)
{
   bit EAstate;
   static short TXI1;
   static unsigned short TXI2;
   static unsigned char top_of_FIFO;   
   static unsigned char top_of_FIFO_mask;   
   static unsigned char last_three_inputs;       



   if(INIT_TX_ALGORITHM)
   {
      top_of_FIFO = 0;
      top_of_FIFO_mask = 0;
      last_three_inputs = 1;
      TXI1 = 0;
      TXI2 = 0;
      accumulate = 0;
      DACstartupTimer = 0;
      INIT_TX_ALGORITHM = 0;
   }
   
   if (top_of_FIFO_mask == 0)         
   {
      EAstate=EA;
      EA = 0;
      top_of_FIFO = URXFIFO_Pull();    
      EA = EAstate;

      top_of_FIFO_mask = 0x80;        
      }

      last_three_inputs<<=1;           
      
      if((top_of_FIFO & top_of_FIFO_mask) != 0)
      {
         last_three_inputs |= 0x01;    
      }
      top_of_FIFO_mask>>=1;            

      
      if (((last_three_inputs & 0x07) == 0x07) || 
         ((last_three_inputs & 0x07) == 0x00))
      {
         TXI2+=DELTAMAX;
      }
      else
      {
         if (TXI2 != 0)
            TXI2-=DELTAMAX;
      }

      
      if(last_three_inputs & 0x01)
      {
         TXI1 += ((TXI2>>I2_TIMECONST) + DELTAMIN);
      }
      else
      {
         TXI1 -= ((TXI2>>I2_TIMECONST) + DELTAMIN);
      }

      
      
      if(!accumulate)
      {
         
         accumulate = (TXI1>>I1_TIMECONST);
      }
      else
      {
         
         accumulate = accumulate + (TXI1>>I1_TIMECONST);
         accumulate = accumulate >> 1; 
         EAstate=EA;
         EA = 0;
         DACTXFIFO_Push(accumulate);   
         EA = EAstate;

         accumulate = 0;              
      }
      
   EA = EAstate;
}

⌨️ 快捷键说明

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