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

📄 dsp_display.h

📁 基于TMS320LF2407的LED大屏幕显示程序
💻 H
📖 第 1 页 / 共 2 页
字号:
#ifndef DSP_DISP_H   
#define DSP_DISP_H


  
void spec_disp(int a){
     int i,j=0,m; 
     int temp;
     unsigned int k;
     volatile unsigned int *pdata=(volatile unsigned int*)  0x8000;                     
      
     g_flag=g_flag|0x20;
     selectchip(g_flag);
     
     for(j=0;j<3;j++){
       temp=a&(1<<j);    
       if(temp!=0){
          pdata=(volatile unsigned int*)  (0x8000+j*0x2000); 
          for(m=0;m<64;m++){
             for(i=0;i<0x16;i++){      
                  k=*pdata;
                  pdata++;
             }
         }  
        }
     }
                 
     g_flag=g_flag&0xDF;
     selectchip(g_flag);
 
 } 
/////////////////// ///////////////////////////
  void clr_dispRam(int kk){
   int i,j; 
   volatile unsigned int *pdata=(volatile unsigned int*)  0x8000;
   g_flag=g_flag|0x08;
   
   selectchip(g_flag);
   for(j=0;j<3;j++){ 
      pdata=(volatile unsigned int*)  0x8000;
      pdata=pdata+j*0x2000;
      for(i=0;i<0x0800;i++){ 
         *pdata=kk;
          pdata++; 
       }
  }
   
   spec_disp(0x07);              
  }
////////////////////////////// 
/*
void move_left(int aa){
    
    int i,j=0,m,n; 
    int temp;
    BYTE g_temp;
    int a,b; 
    BYTE btemp; 
    int fl;
    unsigned int k;
    volatile unsigned char *pdata =(volatile unsigned char*)  0x8000;
    volatile unsigned char *pdata1=(volatile unsigned char*)  0x8000;                     
    volatile unsigned int *pdata2=(volatile unsigned int*)   0x8000; 
                      
    g_temp=g_flag;
    g_flag=g_flag|0x08;
    selectchip(g_flag);    
     
     move_length=128-screen_length*4;
     
     for(j=0;j<3;j++){
       temp=aa&(1<<j);
       if(temp!=0){
          pdata=(volatile unsigned char*)  (0x8000+j*0x2000);
          pdata1=pdata;
          for(m=0;m<48;m++){
             a=0;
             pdata=pdata1+(m+1)*0x80-1;
             for(i=0x7f;i>=move_length;i--){                   
                 btemp=*pdata;
                 b=btemp&0x01;               
                 btemp=btemp>>1; 
                 btemp=btemp|(a<<7);
                 *pdata=btemp;
                 a=b;                 
                 pdata--;
                 
             }
         }  
        }
     }
    g_flag=g_temp;
    selectchip(g_flag);
}     

*/
///////////////////////////////////////////////////////

 
////////////////////////////////////////////////////////
void disp_all(){
   
   int i;   
   BYTE temp;
   volatile unsigned char *pdata =(volatile unsigned char*)  0x8000;
   
   temp=g_flag;
   g_flag=g_flag&0xF0;
   g_flag=g_flag|0x08;
   selectchip(g_flag);
   chgYesNo=30;
   while(chgYesNo>0);
   
   for(i=0;i<1024;i++) 
      *(pdata+i)=*(pdata+1024+i);
   
   pdata =(volatile unsigned char*)  0xa000; 
   for(i=0;i<1024;i++) 
      *(pdata+i)=*(pdata+1024+i); 
   chgYesNo=30;
   while(chgYesNo>0);  

   spec_disp(0x07); 
   chgYesNo=30;
   while(chgYesNo>0);
   if((temp&0x10)==0) 
      g_flag=temp|0x10;
   else
      g_flag=temp&0xEF;      
   selectchip(g_flag);
    

}


void disp_LtoR(){   
   int i,j,m,n;      
   BYTE temp,ch;
   volatile unsigned char *pdata =(volatile unsigned char*)  0x8000;
   
   temp=g_flag;   
   j=0;   
   while(j<127){
      j++;
      ch=0;
      for(i=0;i<8;i++){
         if(i<=(j%8))
            ch=ch+(0x80>>i);      
      }
      
      temp=g_flag;
      g_flag=g_flag&0xF0;
      g_flag=g_flag|0x08;
      selectchip(g_flag);
      for(i=0;i<2;i++){
        if(i==0) pdata =(volatile unsigned char*)  0x8000;
        else     pdata =(volatile unsigned char*)  0xa000;
        for(m=0;m<64;m++){
          for(n=0;n<16;n++){
            if(n<(j/8))
              *(pdata+m*16+n)=*(pdata+m*16+0x400+n);
            if(n==j/8)
              *(pdata+m*16+n)=((*(pdata+m*16+n))&(255-ch))+((*(pdata+m*16+0x400+n))&ch);
                          
          }
        }
      }      

      spec_disp(0x07);
      if((temp&0x10)==0) 
           g_flag=temp|0x10;
      else
           g_flag=temp&0xEF;      
      selectchip(g_flag);
      
      
      while(chgYesNo>0);
      chgYesNo=20;
    }    

     disp_all();
}

// 
void disp_RtoL(){   
   int i,j,m,n;      
   BYTE temp,ch;
   volatile unsigned char *pdata =(volatile unsigned char*)  0x8000;
   
   temp=g_flag;   
   j=127;   
   while(j>=0){
      j--;
      ch=0;
      for(i=0;i<8;i++){
         if(i<=(j%8))
            ch=ch+(0x80>>i);      
      }
      
      temp=g_flag;
      g_flag=g_flag&0xF0;
      g_flag=g_flag|0x08;
      selectchip(g_flag);
      for(i=0;i<2;i++){
        if(i==0) pdata =(volatile unsigned char*)  0x8000;
        else     pdata =(volatile unsigned char*)  0xa000;
        for(m=0;m<64;m++){
          for(n=0;n<16;n++){
            if(n>(j/8)||((n==(j/8))&&((j%8)==0)))
              *(pdata+m*16+n)=*(pdata+m*16+0x400+n);
            if((n==(j/8))&&((j%8)!=0))
              *(pdata+m*16+n)=((*(pdata+m*16+n))&ch)+((*(pdata+m*16+0x400+n))&(255-ch));
                          
          }
        }
      }      

      spec_disp(0x07);
      if((temp&0x10)==0) 
           g_flag=temp|0x10;
      else
           g_flag=temp&0xEF;      
      selectchip(g_flag);
      
      
      while(chgYesNo>0);
      chgYesNo=20;
      
    }    
      disp_all();
}

void disp_LRtoM(){   
   int i,j,j1,m,n; 
   int aa;     
   BYTE temp,ch,ch1;
   volatile unsigned char *pdata =(volatile unsigned char*)  0x8000;
   
   temp=g_flag;   
   j=0;   
   while(j<64){
      j++;
      j1=127-j;      
      ch=0;
      for(i=0;i<8;i++){
         if(i<=(j%8))
            ch=ch+(0x80>>i);      
      }
      ch1=0;
      for(i=0;i<8;i++){
         if(i<=(j1%8))
            ch1=ch1+(0x80>>i);      
      }
      
      temp=g_flag;
      g_flag=g_flag&0xF0;
      g_flag=g_flag|0x08;
      selectchip(g_flag);
      for(i=0;i<2;i++){
        if(i==0) pdata =(volatile unsigned char*)  0x8000;
        else     pdata =(volatile unsigned char*)  0xa000;
        for(m=0;m<64;m++){
             aa=16*m;
          for(n=0;n<16;n++){
            if( (n>(j1/8)||((n==(j1/8))&&((j1%8)==0))) || (n<(j/8))) 
              *(pdata+aa+n)=*(pdata+aa+0x400+n);
            if((n==(j1/8))&&((j1%8)!=0))
              *(pdata+aa+n)=((*(pdata+aa+n))&ch1)+((*(pdata+aa+0x400+n))&(255-ch1));
            if(n==j/8)
              *(pdata+aa+n)=((*(pdata+aa+n))&(255-ch))+((*(pdata+aa+0x400+n))&ch);
                              
          }
        }
      }      

      spec_disp(0x07);
      if((temp&0x10)==0) 
           g_flag=temp|0x10;
      else
           g_flag=temp&0xEF;      
      selectchip(g_flag);
      
      
      while(chgYesNo>0);
      chgYesNo=20;
    }    
     disp_all();
}


void disp_MtoLR(){

   int i,j,j1,m,n; 
   int aa;     
   BYTE temp,ch,ch1;
   volatile unsigned char *pdata =(volatile unsigned char*)  0x8000;
   
   temp=g_flag;   
   j=63;   
   while(j>0){
      j--;
      j1=127-j;      
      ch=0;
      for(i=0;i<8;i++){
         if(i<=(j%8))
            ch=ch+(0x80>>i);      
      }
      ch1=0;
      for(i=0;i<8;i++){
         if(i<=(j1%8))
            ch1=ch1+(0x80>>i);      
      }
      
      temp=g_flag;
      g_flag=g_flag&0xF0;
      g_flag=g_flag|0x08;
      selectchip(g_flag);
      for(i=0;i<2;i++){
        if(i==0) pdata =(volatile unsigned char*)  0x8000;
        else     pdata =(volatile unsigned char*)  0xa000;
        for(m=0;m<64;m++){
             aa=16*m;
          for(n=0;n<16;n++){
            if( n<(j1/8) && ((n>(j/8))||((n==(j/8))&&(j%8==0)) )) 
              *(pdata+aa+n)=*(pdata+aa+0x400+n);
            if(n==(j1/8))
              *(pdata+aa+n)=((*(pdata+aa+n))&(255-ch1))+((*(pdata+aa+0x400+n))&ch1);
            if((n==j/8)&&(j%8!=0))
              *(pdata+aa+n)=((*(pdata+aa+n))&ch)+((*(pdata+aa+0x400+n))&(255-ch));
                              
          }
        }
      }      

      spec_disp(0x07);
      if((temp&0x10)==0) 
           g_flag=temp|0x10;
      else
           g_flag=temp&0xEF;      
      selectchip(g_flag);
      
      
      while(chgYesNo>0);
      chgYesNo=20;
    }    
     disp_all();

}

void disp_UtoD(){
   int i,j,m,n;      
   BYTE temp;
   volatile unsigned char *pdata =(volatile unsigned char*)  0x8000;
   
   temp=g_flag;   
   j=0;   
   while(j<64){
         
      temp=g_flag;
      g_flag=g_flag&0xF0;
      g_flag=g_flag|0x08;
      selectchip(g_flag);
      
      for(i=0;i<2;i++){
        if(i==0) pdata =(volatile unsigned char*)  0x8000;
        else     pdata =(volatile unsigned char*)  0xa000;
        for(m=0;m<64;m++){
          for(n=0;n<16;n++){
            if(m==j)
              *(pdata+m*16+n)=*(pdata+m*16+0x400+n);
            
          }
        }
      }      
      j++;
      while(chgYesNo>0);
      chgYesNo=20;    
     
      spec_disp(0x07);
      if((temp&0x10)==0) 
           g_flag=temp|0x10;
      else
           g_flag=temp&0xEF;      
      selectchip(g_flag);
      
      
      while(chgYesNo>0);
      chgYesNo=10;
    }    

     disp_all();


}


void disp_DtoU(){
   int i,j,m,n;      
   BYTE temp;
   volatile unsigned char *pdata =(volatile unsigned char*)  0x8000;
   
   temp=g_flag;   
   j=63;   
   while(j>0){
         
      temp=g_flag;
      g_flag=g_flag&0xF0;
      g_flag=g_flag|0x08;
      selectchip(g_flag);
      for(i=0;i<2;i++){
        if(i==0) pdata =(volatile unsigned char*)  0x8000;
        else     pdata =(volatile unsigned char*)  0xa000;
        for(m=0;m<64;m++){
          for(n=0;n<16;n++){
            if(m==j)
              *(pdata+m*16+n)=*(pdata+m*16+0x400+n);            
          }
        }
      } 
      j--;
        
      while(chgYesNo>0);
      chgYesNo=20;    
     
      spec_disp(0x07);
      if((temp&0x10)==0) 
           g_flag=temp|0x10;
      else
           g_flag=temp&0xEF;      
      selectchip(g_flag);
      
      
      while(chgYesNo>0);
      chgYesNo=10;
    }    

     disp_all();


}

void disp_DUtoM(){
   int i,j,m,n;      
   BYTE temp;
   volatile unsigned char *pdata =(volatile unsigned char*)  0x8000;
   
   temp=g_flag;   
   j=0;
   
   
        
   while(j<32){
         
      temp=g_flag;
      g_flag=g_flag&0xF0;
      g_flag=g_flag|0x08;
      
      selectchip(g_flag);
      for(i=0;i<2;i++){
        if(i==0) pdata =(volatile unsigned char*)  0x8000;
        else     pdata =(volatile unsigned char*)  0xa000;
        for(m=0;m<64;m++){
          for(n=0;n<16;n++){
            if((m==j)||(m==63-j))
              *(pdata+m*16+n)=*(pdata+m*16+0x400+n);            
          }
        }
      }      
      j++;
      
      while(chgYesNo>0);
      chgYesNo=20;    
     
      spec_disp(0x07);
      if((temp&0x10)==0) 
           g_flag=temp|0x10;
      else
           g_flag=temp&0xEF;      
      selectchip(g_flag);
      
      
      while(chgYesNo>0);
      chgYesNo=10;
    }    

     disp_all();


}



void disp_MtoDU(){
   int i,j,m,n;      
   BYTE temp;
   volatile unsigned char *pdata =(volatile unsigned char*)  0x8000;
   
   temp=g_flag;   
   j=0;   
   while(j<32){
         
      temp=g_flag;
      g_flag=g_flag&0xF0;
      g_flag=g_flag|0x08;
      selectchip(g_flag);
      
      for(i=0;i<2;i++){
        if(i==0) pdata =(volatile unsigned char*)  0x8000;
        else     pdata =(volatile unsigned char*)  0xa000;
        for(m=0;m<64;m++){
          for(n=0;n<16;n++){
            if((m==31-j)||(m==31+j))
              *(pdata+m*16+n)=*(pdata+m*16+0x400+n);            
          }
        }
      }      
      j++;
      while(chgYesNo>0);
      chgYesNo=20;    
     
      spec_disp(0x07);
      if((temp&0x10)==0) 
           g_flag=temp|0x10;
      else
           g_flag=temp&0xEF;      
      selectchip(g_flag);
      
      
      while(chgYesNo>0);
      chgYesNo=10;
    }    

     disp_all();


}

///////////////////////////////////
void disp_LUtoRD(){   
   int i,j,m,n;      
   BYTE temp,ch;
   volatile unsigned char *pdata =(volatile unsigned char*)  0x8000;
   
   temp=g_flag;   
   j=0;   
   while(j<127){
      j++;
      ch=0;
      for(i=0;i<8;i++){
         if(i<=(j%8))
            ch=ch+(0x80>>i);      
      }
      
      temp=g_flag;
      g_flag=g_flag&0xF0;
      g_flag=g_flag|0x08;
      selectchip(g_flag);
      for(i=0;i<2;i++){
        if(i==0) pdata =(volatile unsigned char*)  0x8000;
        else     pdata =(volatile unsigned char*)  0xa000;
        for(m=0;m<64;m++){
          for(n=0;n<16;n++){
            if(m==j/2)
              *(pdata+m*16+n)=*(pdata+m*16+0x400+n);
            if(m>=j/2){
               if(n<(j/8))
                 *(pdata+m*16+n)=*(pdata+m*16+0x400+n);
               if(n==j/8)
                 *(pdata+m*16+n)=((*(pdata+m*16+n))&(255-ch))+((*(pdata+m*16+0x400+n))&ch);
                          
            }
          }
        }
      }      

      spec_disp(0x07);
      if((temp&0x10)==0) 
           g_flag=temp|0x10;
      else

⌨️ 快捷键说明

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