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

📄 vfd_disp.c

📁 日本FAMILY按摩椅W-1用的配套操作器程序。带VFD显示
💻 C
📖 第 1 页 / 共 3 页
字号:
  }
}    
  
/*********** start send vfd disp data ***********/
/********** timer5 8 ms interrupt     ***********/
/************************************************/


void Start_send(void)
{
   unsigned char i ;
   NOP();
   EI();
 //  TMIF00 = 0;
 TMIF6 = 0 ;

//   TMMK00 =1;
   TMMK6 = 1 ;
   if(clrscr_F == 1)
   {
     for(i=0;i<39;i++)
            memset(d_d_send_data+i,0x00,12);
     clrscr_F = 0 ;
   }
   else if(prc_column_F)
    {
       Change_d_d_send_data();
       prc_column_F = 0;
       
    }
// VFD_BK = 0;            //BRIGHT ON
// VFD_LAT = 0 ;          //NO LATCH
     
      MSC = 0x12 ; 
      SRISM1=1;                //enable macro interrupt
     
 MP_H = 0x0f;
// MP_L=( unsigned char*)d_d_send_data;
 MP_L=( unsigned int)d_d_send_data;
//MP_L = 0xee35 ;
 P2.2= 0 ;
// SIO1 = *((unsigned char*)MP_L+0x0f0000);
SIO1 = d_d_send_data[0][0] ;
// send_byte_count++;
 SRMK1 = 0 ;  


 }
/***************SIO interrupt precess ***********/
/************************************************/


void Send_vfd_data(void)
{  
    NOP();
    NOP(); 
    EI();
    SRIF1 = 0;
//    TMMK00 =1;
    P2.2=1;
   
     VFD_BK = 1 ;
     VFD_LAT = 1 ;
   
//     Delay_3us();
	NOP();
	NOP();
	NOP();
	NOP();
	NOP();
	
    scan_count++;
    VFD_LAT = 0;
    VFD_BK = 0 ;
   
    if(scan_count<39)
    {
      MSC = 0x12 ; 
      SRISM1=1;                //enable macro interrupt
      
      P2.2=0 ;
//      SIO1 = *((unsigned char*)MP_L+0x0f0000) ;
      SIO1 = d_d_send_data[scan_count][0] ;
    } 
   else
   {
      SRMK1 = 1;
 /*     CSIMMD1 = 0x08;
      CSICHP1 = 0x84;
      MSC = 0x12 ;
      SFRP = 0x95;   */
//      MSC = 0x12 ; 
//      SRISM1=1;                //enable macro interrupt
      scan_count = 0;
      TMMK6 = 0 ;
    }
 
 }
 
/***********************************************/
/***********************************************/
void	Get_next_font_adr(unsigned char *s)
{
//	if(*s!='\0')
    if( *s  != 0x00)
	{
//		if(*(s + 1) != '\0')
        if( *(s+1) != 0x00)
		{
			if(isascii2((int)*s & 0xff))
			{
				if(*s != '\r')    //not return
				{
		//			DTput((int)*s & 0xff) ;			//2003-11-1
				font_dot_p=(unsigned int*)DFontadr(((unsigned int)*s)<<8);	//2003-11-1	add
				old_font_dot_p=font_dot_p+fetch_dot_no;		//2003-11-1	add
				++s ;
				}
				
			}
			else
			{
		//		DTput(*(int*)s) ;
				font_dot_p=(unsigned int *)DFontadr(*(unsigned int *)s);	//2003-11-1	add
				old_font_dot_p=font_dot_p+fetch_dot_no;		//2003-11-1	add
				++((unsigned int *)s);
				
			}
		}
		else
		{
	//		DTput((int)*s & 0xff) ;
			font_dot_p=(unsigned int *)DFontadr(((unsigned int)*s)<<8);	//2003-11-1	add
			old_font_dot_p=font_dot_p+fetch_dot_no;		//2003-11-1	add			
			++s;
		}
		code_p = s;
	}
	else  
	    disp_empty_F = 1;
	 
}

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

int		isascii2( int c )
{

	if(((c >= 0) && (c <= 0x7f)) || ((c > 0xa0) && (c < 0xe0)))
	
	
	{

		return(1);
	}
	return(0);
}

 
/*****************************************************/
/****** 25 ms interrupt move one column  precess *****/
/******* timer0 interrupt ****************************/


void Column_move_data_prc(void)

{
   NOP();
   EI();
   TMIF00 = 0 ;
  if((clrscr_F != 1)&&(prc_column_F == 0))
  {
      if(disp_mode == LIU_DISP_MODE)          //liudon disp
      {
      	move_count++;
      	if(move_count==7)
         	move_count=1;
      	if(font_dot_p>=old_font_dot_p)		//2003-11-1	add
	        Get_next_font_adr(code_p);		//2003-11-1	add  
      	Get_0_34_disp_data();
      	Get_35_disp_data();
     	Get_36_disp_data();
      	Get_37_disp_data();
      	prc_column_F=1;
   	  }
      else if(disp_mode == FIX_DISP_MODE)
   	  {
   		  if(FIX_PRC_F == 1)	 
          {      
              Fix_disp_prc();              
              FIX_PRC_F = 0 ;
          }
        
      }
   } 
}

/***************************************/
/***************************************/      
void G1g2_scan_data(void)
{
 
  unsigned char (*p)[18] = d_d_send_data[0] ;
   //        d_d_send_data[i][12] = 0xc0 ;             //G1 G2 = 1 ;
             *(*(p+0)+12) = 0xc0 ;
             *(*(p+1)+12) = 0xc0>>1 ;
             *(*(p+2)+12) = 0xc0>>2 ;
             *(*(p+3)+12) = 0xc0>>3 ;
             *(*(p+4)+12) = 0xc0>>4 ;
             *(*(p+5)+12) = 0xc0>>5 ;
             *(*(p+6)+12) = 0xc0>>6 ;
             *(*(p+7)+12) = 0x01    ;
             *(*(p+7)+13) = 0x80    ;
             
             *(*(p+8)+13) = 0xc0 ;
             *(*(p+9)+13) = 0xc0>>1 ;
             *(*(p+10)+13) = 0xc0>>2 ;
             *(*(p+11)+13) = 0xc0>>3 ;
             *(*(p+12)+13) = 0xc0>>4 ;
             *(*(p+13)+13) = 0xc0>>5 ;
             *(*(p+14)+13) = 0xc0>>6 ;
             *(*(p+15)+13) = 0x01    ;
             *(*(p+15)+14) = 0x80 ;
             
             *(*(p+16)+14) = 0xc0 ;
             *(*(p+17)+14) = 0xc0>>1 ;
             *(*(p+18)+14) = 0xc0>>2 ;
             *(*(p+19)+14) = 0xc0>>3 ;
             *(*(p+20)+14) = 0xc0>>4 ;
             *(*(p+21)+14) = 0xc0>>5 ;
             *(*(p+22)+14) = 0xc0>>6 ;
             
             *(*(p+23)+14) = 0x01 ;
             *(*(p+23)+15) = 0x80 ;
             
             *(*(p+24)+15) = 0xc0 ;
             *(*(p+25)+15) = 0xc0>>1 ;
             *(*(p+26)+15) = 0xc0>>2 ;
             *(*(p+27)+15) = 0xc0>>3 ;
             *(*(p+28)+15) = 0xc0>>4 ;
             *(*(p+29)+15) = 0xc0>>5 ;
             *(*(p+30)+15) = 0xc0>>6 ;
             
             *(*(p+31)+15) = 0x01 ;
             *(*(p+31)+16) = 0x80 ;
             
             *(*(p+32)+16) = 0xc0 ;
             *(*(p+33)+16) = 0xc0>>1 ;
             *(*(p+34)+16) = 0xc0>>2 ;
             *(*(p+35)+16) = 0xc0>>3 ;
             *(*(p+36)+16) = 0xc0>>4 ;
             *(*(p+37)+16) = 0xc0>>5 ;
 }
/*****************************/
/*void G1g2_scan_data(unsigned char i)
{
  unsigned char i ;
  unsigned char *p = d_d_send_data
  switch(i)
  {
   case 0 :
           d_d_send_data[i][12] = 0xc0 ;             //G1 G2 = 1 ;
           break ;
   case 1:
   case 2:
   case 3:
   case 4:
   case 5:
   case 6:
          d_d_send_data[i][12] =  d_d_send_data[i-1][12] >> 1 ;  
          break;
   case 7:
          d_d_send_data[i][12] = 0x01 ;
          d_d_send_data[i][13] = 0x80 ;
          break;                              //first byte over
   case 8 :
          d_d_send_data[i][12] = 0x00 ;
          d_d_send_data[i][13] = 0xc0 ;
          break;
   case 9:
   case 10:
   case 11:
   case 12:
   case 13:
   case 14:
        
          d_d_send_data[i][13] =  d_d_send_data[i-1][13] >> 1 ; 
          break; 
   case 15:      
           d_d_send_data[i][13] = 0x01 ;
           d_d_send_data[i][14] = 0x80 ;
           break;
   case 16:                                          /* second byte g1g2 over */
       
 /*          d_d_send_data[i][13] = 0x00 ;
           d_d_send_data[i][14] = 0xc0 ;
          break;
   case 17:
   case 18:
   case 19:
   case 20:
   case 21:
   case 22:
       
          d_d_send_data[i][14] =  d_d_send_data[i-1][14] >> 1 ; 
          break;
   case 23: 
          d_d_send_data[i][14] = 0x01 ;
          d_d_send_data[i][15] = 0x80 ;
          break;
   case 24:                                        /* third byte g1g2 over */
/*          d_d_send_data[i][14] = 0x00 ;
          d_d_send_data[i][15] = 0xc0 ;
          break;
   case 25:
   case 26:
   case 27:
   case 28:
   case 29:
   case 30:
       
          d_d_send_data[i][15] =  d_d_send_data[i-1][15] >> 1 ;  
          break;
   case 31:
          d_d_send_data[i][15] = 0x01 ;
          d_d_send_data[i][16] = 0x80 ;
          break;
   case 32:                                       /* fouth byte g1g2 over */
/*          d_d_send_data[i][15] = 0x00 ;
          d_d_send_data[i][16] = 0xc0 ;
          break;
   case 33:
   case 34:
   case 35:
   case 36:
   case 37:
          d_d_send_data[i][16] =  d_d_send_data[i-1][16] >> 1 ;  
          break;                                   /* fifth byte g1g2 over */
/*
   default: 
          break;
   }
}
/*****************************/

⌨️ 快捷键说明

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