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

📄 test.c

📁 日本FAMILY按摩椅W-1用的配套操作器程序。带VFD显示
💻 C
字号:
/***********************************/
/********* vfd test ****************/
#pragma		sfr
#pragma		nop
#include	<stdio.h>
#include	<string.h>
#include	"dlcd.h"
#include	"trm.h"
#include	"tmr.h"
#include	"sound.h"
#include	"flag.h"		
#include    "iconprc.h"
#include    "vfd.h"
#include    "text.h"
#include    "key_hl.h"
#include    "mode.h"
#include    "cmd.h"
#include    "test.h"
/*****************************************/
/*****************************************/
unsigned char area_p,disp_empty_column;
bit test_F;
/******************************************/
  void Test_key_disp_init(void);
  void Bright_on_off(unsigned char area,unsigned char disp_status);
  unsigned char Judge_up_down_area(unsigned char area);
  void Half_up_prc(unsigned char area,unsigned char disp_status);
  void Half_down_prc(unsigned char area,unsigned char disp_status) ;
  void Test_key(void) ;
  void Bright_all_vfd(void);
  void Bright_square_vfd(void) ;
  void Sound_test(void );
  char Flash_rom_test (void) ;




const unsigned char *test_dsp_tbl[] ={
				 
					"",
					"ROM OK",
					"ROM NG",
					"壒惡嵞惗拞",
					""
					} ;                                    
const unsigned char rom_verify_data_tbl[] =
      				{0x00,0x00,0x00,0x8f,0x8d,0x8c,0x67,0x65,0x66,0x6a,0x64,0x5d,
      				 0x80,0x80,0x80,0x88,0x85,0x82,0x6a,0x6a,0x6d,0x8f,0x8d,0x90,
      				 0x80,0x80,0x80,0x7e,0x7e,0x7e,0x68,0x6b,0x70,0x7b,0x7d,0x7c,
      				 0x80,0x80,0x80,0x71,0x6d,0x69,0x84,0x82,0x81,0x8d,0x8f,0x8f};
					                                                                           
const unsigned long int rom_test_addr[] = 
    				{0x00080000,0x00099999,0x000aaaaa,0x000d5555};
                                     
/***********************  VFD DISP ----->>>>>P1-SW1 AREA ****************/
/***********************************************************************************************************************/
/* P1  P2  P3  P4  P5  P6  P7  P8  P9  P10  P11  P12  P13  P14  P15  P16  P17  P18  P19  P20  P21  P22  P23  HALF_UP****/
/***********************************************************************************************************************/
/* P24 P25 P26 P27 P28 P29 P30 P31 P32 P33  P34  P35  P36  P37  P38  P39  P40  P41  P42  P43  P44  P45  SW1  HALF_DOWN**/
/***********************************************************************************************************************/
typedef  struct{
             unsigned char high_byte;
             unsigned char low_byte;
            }H_L;

 
 /*****************************************/
 /*****************************************/
  void Test_key_disp_init(void)
  {
    Bright_on_off(P1_AREA,BRIGHT_ON);    
    Bright_on_off(P2_AREA,BRIGHT_ON);
    Bright_on_off(P9_AREA,BRIGHT_ON);
    Bright_on_off(P10_AREA,BRIGHT_ON);
    Bright_on_off(P17_AREA,BRIGHT_ON);
    Bright_on_off(P24_AREA,BRIGHT_ON);
    Bright_on_off(P27_AREA,BRIGHT_ON);
    Bright_on_off(P31_AREA,BRIGHT_ON);
    Bright_on_off(P36_AREA,BRIGHT_ON);
    Bright_on_off(P42_AREA,BRIGHT_ON);    
    Bright_on_off(P44_AREA,BRIGHT_ON);
    
    disp_mode= FIX_DISP_MODE;
    font_dot_p =(unsigned int*)two_direct_data;
    old_font_dot_p = font_dot_p+112 ;
    disp_empty_F = 0 ;
    FIX_PRC_F = 1 ;
  }
/***************************************/
/***************************************/  
void Bright_on_off(unsigned char area,unsigned char disp_status)
{
  H_L *hl_p;  
  hl_p= (H_L *)two_direct_data;
  if((Judge_up_down_area(area)) == HALF_UP_AREA)
     Half_up_prc(area,disp_status);
  else 
     Half_down_prc(area,disp_status);
     
        font_dot_p =(unsigned int*)two_direct_data;
        old_font_dot_p = font_dot_p+112 ;
         disp_empty_F = 0 ;
         
         disp_mode = FIX_DISP_MODE;
         FIX_PRC_F = 1;
     
 }   
  /***********************************************/
  /***********************************************/
    
  /**********************************************/
  /**********************************************/  
 unsigned char Judge_up_down_area(unsigned char area)
    {
      if(area >= P24_AREA)
         return(HALF_DOWN_AREA);
      else
         return(HALF_UP_AREA);
     }
     
  /*********************************************/
  void Half_up_prc(unsigned char area,unsigned char disp_status)
  {
    unsigned char NO,i;
    H_L *hl_p;
    hl_p= (H_L *)two_direct_data;
    if((area == P1_AREA)||(area == P2_AREA)||(area== P3_AREA))      
    {
        NO = (area-1)*4 ;
        for(i=NO;i<NO+4;i++)
  //        (hl_p+i)->high_byte =0xff;
            if(disp_status == BRIGHT_ON)
               (hl_p+i)->low_byte =0xff;
            else
               (hl_p+i)->low_byte =0x00;
   
    }            
    else if((area >= P4_AREA)&&(area <= P23_AREA))
    { 
        NO = (area-4)*5+12 ;
        for(i=NO;i<NO+5;i++)
            if(disp_status == BRIGHT_ON)
               (hl_p+i)->low_byte =0xff;
            else
               (hl_p+i)->low_byte =0x00;
 
    }
   }
 /**********************************************/
 /**********************************************/  
  void Half_down_prc(unsigned char area,unsigned char disp_status)
  {
    unsigned char NO,i;
    H_L *hl_p;
    hl_p= (H_L *)two_direct_data;
    if((area == P24_AREA)||(area == P25_AREA)||(area== P26_AREA))      
    {
        NO = (area-24)*4 ;
        for(i=NO;i<NO+4;i++)
 //         (hl_p+i)->low_byte =0xff;
            if(disp_status == BRIGHT_ON)
               (hl_p+i)->high_byte =0xff;
            else
               (hl_p+i)->high_byte =0x00;
            
    }            
    else if((area >= P27_AREA)&&( area <= SW1_AREA))
    { 
        NO = (area-27)*5+12 ;
        for(i=NO;i<NO+5;i++)
//          (hl_p+i) -> low_byte = 0xff;
            if(disp_status == BRIGHT_ON)
               (hl_p+i)->high_byte =0xff;
            else
               (hl_p+i)->high_byte =0x00;
           
    }
  }
  
/*******************************************/
/*******************************************/   
void Test_key(void)
{
  if((test_area >= P1_AREA)&&(test_area<= SW1_AREA))
      {
         Bright_on_off(test_area,BRIGHT_ON);
     } 
 }   
  
/****************************************/
/****************************************/  
 void Bright_all_vfd(void)
 {
   memset(two_direct_data,0xff,224);
   disp_mode = FIX_DISP_MODE;
   font_dot_p =(unsigned int*)two_direct_data;
   old_font_dot_p = font_dot_p+112 ;
   disp_empty_F = 0 ;
   FIX_PRC_F = 1 ;
 } 
 
 
 /***************************************/
 /**** disp fankuan icon ****************/
 void Bright_square_vfd(void)
 {
    unsigned char i;
    H_L *hl_p;  
    hl_p= (H_L *)two_direct_data;
    hl_p->high_byte=0xff;
    hl_p->low_byte=0xff;
    for(i=1;i<111;i++)
    {
      (hl_p+i)->high_byte = 0x01;
      (hl_p+i)->low_byte = 0x80;
    }
    (hl_p+111)->high_byte=0xff;
    (hl_p+111)->low_byte=0xff;
   disp_mode = FIX_DISP_MODE;
   font_dot_p =(unsigned int*)two_direct_data;
   old_font_dot_p = font_dot_p+112 ;
   disp_empty_F = 0 ;
   FIX_PRC_F = 1 ;
 }   
 
 
 
 
//**********************************************************
//    sound test 
//**********************************************************
void Sound_test (void )
{
//	play_sound_no = PLAY_SOUND_START ;
flash_start=(unsigned char *) 0x00000400;
TMMK5= 0 ;
TCE5 = 1 ;
CHIP_AON = AON ;
sound_prc_F = 1 ;
}
//**********************************************************
//    falsh rom test 
//**********************************************************

 char  Flash_rom_test (void )
{
	  unsigned char data[12] ,j,i,k; 
	 
	  if (address == 0 )
	  {
	  	P3.0 = 0 ;
	  	P3.1 = 0 ;
	  }
	  else if (address == 1)
	  {
	  	P3.0 = 1 ;
	  	P3.1 = 0 ;
	  }
	  else if (address == 2 )
	  {
	  	P3.0 = 0 ;
	  	P3.1 = 1 ;
	  }
	  
	  else if (address == 3 )
	  {
	  	P3.0 = 1 ;
	  	P3.1 = 1 ;
	  }
//	  flash_start =(unsigned char *)(rom_test_addr[3]+0x80000) ;
	  for (k=0;k<4;k++)
	  {
	  flash_start =(unsigned char *)rom_test_addr[k] ;
	   
	   	data[k*3] = *flash_start ;
	   	NOP();
	   	NOP();
	   	flash_start++ ;
	   	data[k*3+1] = *flash_start ;
	   	NOP();
	   	NOP();
	   	
	   	flash_start++ ;
	   	data[k*3+2] = *flash_start ;
	   	NOP();
	   	NOP();
//	   	flash_start++;
	   	
	  } 
	   for (i=0;i<12;i++)
	   {
	   		if (data[i] == rom_verify_data_tbl[address*12+i])
	   			j = 0; 
	   		else
	   		{
				j = -1 ;
				break ;
			}
	   	}	
	
	address++ ;
	return (j) ;
		
		
}

⌨️ 快捷键说明

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