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

📄 dsp_display.h

📁 基于TMS320LF2407的LED大屏幕显示程序
💻 H
📖 第 1 页 / 共 2 页
字号:
           g_flag=temp&0xEF;      
      selectchip(g_flag);
      
      
      while(chgYesNo>0);
      chgYesNo=20;
    }    

     disp_all();
}


void disp_LDtoRU(){   
   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==(63-j/2))
              *(pdata+m*16+n)=*(pdata+m*16+0x400+n);
            if(m<(63-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
           g_flag=temp&0xEF;      
      selectchip(g_flag);
      
      
      while(chgYesNo>0);
      chgYesNo=20;
    }    

     disp_all();
}


///////////////////////////////
void disp_RUtoLD(){
   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(m==63-j/2)
              *(pdata+m*16+n)=*(pdata+m*16+0x400+n);
            if(m>63-j/2){
               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_MtoLRUD(){

   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((m==j/2)||((m==j1/2)))
               *(pdata+aa+n)=*(pdata+aa+0x400+n);
            if((m<j/2)||((m>j1/2))){
               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_RDtoLU(){
   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(m==j/2)
              *(pdata+m*16+n)=*(pdata+m*16+0x400+n);
            if(m<j/2){
               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_LRUDtoM(){   
   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((m==j/2)||((m==j1/2)))
               *(pdata+aa+n)=*(pdata+aa+0x400+n);
            if((m>j/2)&&((m<j1/2))){
            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();
}
////////////////////////////////
int disp_YesNo(volatile unsigned char *p){
    BYTE temp;
    BYTE yn,yn1;
    BYTE kk;
    
    yn=0;
    yn1=0;
    
    temp=g_flag;
    
    
    if((*(p+0))!=0x50)
       return 0;
    if((*(p+15))!=0xa0)
       return 0;  
    
    if(((*(p+5))&0x01)!=0)
        return 3;
            
    //read_time(pTime);
    if((*(pTime+6))==0) 
        *(pTime+6)=7; 
    kk=1<<(*(pTime+6));
    kk=kk&0xff;
    if((kk&(*(p+5)))!=0)
       yn=yn+1;
    
    if((*(p+6))==0xff)
       yn=yn+1;
    if((*(p+6))!=0xff){  
       if((*(p+6))<(*(pTime+9)))
            yn1=1;
       if(((*(p+6))==(*(pTime+9)))&&((*(p+7))<(*(pTime+8))))
            yn1=1;     
       if(((*(p+6))==(*(pTime+9)))&&((*(p+7))==(*(pTime+8)))&&((*(p+8))<=(*(pTime+87))))
            yn1=1;
       
       if((*(p+9))>(*(pTime+9)))
            yn1=yn1+1;
       if( ( (*(p+9)) == (*(pTime+9)) )&&( (*(p+10))>(*(pTime+8)) ))
            yn1=yn1+1;
       if(((*(p+9))==(*(pTime+9)))&&((*(p+10))==(*(pTime+8)))&&((*(p+11))>=(*(pTime+87))))
           yn1=yn1+1;
       if(yn1>=2)
           yn=yn+1; 
    }
    yn1=0;
    if((*(p+12))==0xff)
       yn=yn+1;
    if((*(p+12))!=0xff){ 
       if(( (*(p+12))/10 )<(*(pTime+4))) 
            yn1=1;        
       if((((*(p+12))/10)==(*(pTime+4)))&&(((*(p+12))%10)>=(*(pTime+2))/10))
            yn1=1;
       if( ( (*(p+13))/10) <(*(pTime+4)) )
            yn1=yn1+1;
       if((((*(p+13))/10)>=(*(pTime+4)))&&(((*(p+13))%10)>=(*(pTime+2))/10))
            yn1=yn1+1;
       if(yn1>=2)
           yn=yn+1; 
    }
    
    
    g_flag=temp;
    selectchip(g_flag);
     
    return yn;
}

////////////////////////////////////////////////////////
void total_disp(){     
      int kk;
      int a,b;
      BYTE temp;
      flash_read_cycle(num_dd);
      a=(*pInfo)&(0x00ff);
      b=(*(pInfo+1))&(0x00ff);
      if(a==0xff)
          return;
      kk=a*256+b;
      rand_num++;
      if(rand_num>=16)
         rand_num =1;
             
      if(num_dd>=kk){
         num_dd=0;
         flash_read_cycle(num_dd);
       } 
       num_dd++;      
       a=disp_YesNo(pInfo+2);
       if(a!=3){ 
          i_delay=0;
          return ;
       }
       
       a=(*(pInfo+3))&(0x00ff);
       b=(*(pInfo+4))&(0x00ff);
       kk=a*256;       
       kk=kk+b;
       move_data(kk);
       
       kk=(*(pInfo+5))&(0x00ff);
       kk=kk%15;
       if(kk==0) 
          kk=rand_num%15;
       
       chgYesNo=20;
       while(chgYesNo>0);       
       
       if(kk==1)
          disp_LtoR();
       if(kk==2)
          disp_RtoL();
       if(kk==3)       
         disp_MtoLR();
       if(kk==4)
         disp_LRtoM();
       if(kk==5)
         disp_UtoD(); 
       if(kk==6)
         disp_DtoU(); 
       if(kk==7)
         disp_MtoDU();
       if(kk==8)
         disp_DUtoM();  
       if(kk==9)
         disp_LUtoRD();
       if(kk==10)
         disp_LDtoRU();
       if(kk==11)
         disp_RDtoLU();
       if(kk==12)
         disp_RUtoLD();
       if(kk==13)
         disp_MtoLRUD();
       if(kk==14)
         disp_LRUDtoM();
       if(kk>14) 
          disp_all();
       if(kk==0)
          disp_all();
       i_delay=(*(pInfo+6))&(0x00ff); 
       if(i_delay<10)
         i_delay=10;  
       
       
}
////////////////////////////////////////////////////////
/* 翻屏显示   */
/////////////////////////// 
/*排屏*/ 
#ifdef  _TEST_LINE
void sort_screen(int m,int n,volatile unsigned char *p,int i_wide,BYTE i_color){
	volatile unsigned char *p_Pre;
	int i,j,k;
	BYTE dd;
	for(j=0;j<64;j++){
	    for(i=0;i<i_wide;i++){
	       //if((i_wide%2)==0){
	       	   for(k=0;k<3;k++){
	       	      dd=i_color&(1<<(2-k));    ///
	       	       if(dd!=0){
	       	       	 if(k==0)
	       	       	    p_Pre=(volatile unsigned char*)0x8000;
	       	       	 if(k==1)
	       	       	    p_Pre=(volatile unsigned char*)0xa000; 
	       	       	 if(k==2)
	       	       	    p_Pre=(volatile unsigned char*)0xc000;
	       	         if((m*4+n+i)<16)
	                    *( p_Pre+j*16+m*4+n+i )=*(p+i_wide*j+i);
	                 if((m==3)&&((n+i)==3))
	                    *( p_Pre+j*16+m*4+n+i )=j;    
	                 /*if((m==3)&&((n+i)==2))
	                    *( p_Pre+j*16+m*4+n+i )=0xa5; */  
	                }
                }
           //}
	       
	    }///*for  i<i_wide*/
	}

}

void make_lean(int a){    
     int i;
     int k;
     k=a/48;     
     
     for(i=0;i<256;i++){
             
        if(k==0)
          *(pdata48+i)=1<<(((i/4)+(i%4)*8+(a%32))%32) ;
        else 
          *(pdata48+i)=1<<(31-(((i/4)+(i%4)*8+(a%32))%32)) ;
     
     }     
}

void test_lean(){
     int m,n;
     int k;
     int kk;
     int aa=0x08;
     
     
     m=0;
     n=0;
     kk=0;
     k=0;
     selectchip(0x08);  
     clr_dispRam(0x0000);
     selectchip(0x18);  
     clr_dispRam(0x0000);
     selectchip(0x08);
     do{
        
        make_lean(k);  
        m=0;
        n=0;
        while(m<4){   
          if(kk<2)     
            sort_screen(m,n,pdata48,4,(4>>kk));
          else
            sort_screen(m,n,pdata48,4,7);
          m=m+((n+4)/4);
          n=(n+4)%4;       
        }
        
        spec_disp(0x07);
        if(aa==0x08)
           aa=0x18;
        else
           aa=0x08;
        selectchip(aa);  
        
        my_second=1;
        div_second=600;
        while(my_second>0);
        
        k++;
        //k=0;
        if(k>31){
            k=0;
            kk++;
            selectchip(0x08);  
            clr_dispRam(0x0000);
            selectchip(0x18);  
            clr_dispRam(0x0000); 
            
        }
       
      }while(kk<3);
       
}
/// 
#endif
void com_movedata(volatile unsigned char *p){
     BYTE temp;
     volatile unsigned char *pdata =(volatile unsigned char*)  0x8000;
     int i;
     
     temp=g_flag;
     g_flag=g_flag|0x08;
     selectchip(g_flag);
          
     
     if((*p)>1)
      pdata=pdata+0x2000;
     
     for(i=0;i<512;i++){
      *(pdata+((*p)%2)*0x200+0x400+i)=*(p+i+1);     
     }
     
     if((*p)==0x03)
       disp_all();
     //g_flag=temp;
     //g_flag=g_flag|0x08;
     //selectchip(g_flag);


}

#endif

⌨️ 快捷键说明

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