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

📄 self_detect.c

📁 税控收款机源码:拼音输入法,LCD,VFD驱动,IC卡驱动,税控国标
💻 C
📖 第 1 页 / 共 2 页
字号:
   write_sramb(0,10,backup[0]);
   delayms(100);
   write_sramb(0x40000,10,backup[1]);
   delayms(100);
   write_sramb(0x7fff0,10,backup[2]);
   delayms(6000);

	 
}



//====================================================
//function:keyboard self-detecting
//
//
//====================================================
void self_detect_keyboard(void)
{
	uchar key;
	uchar esc_flag;
	uchar y_pos;
	uchar buf[30];
    //uchar keycnt;

	//keycnt=0;
	esc_flag = 0;
	y_pos = 0;


	clear_lcd(0,MAX_LCD_NUM);
	sprintf(buf,"请注意,双击[确定]键退出键盘检测");
	lcd_disp(0,0,buf);
	delayms(8000);
    clear_lcd(0,MAX_LCD_NUM);
	while(1)
	{
		while(1)
		{
			key = get_key();
			if(key)
				break;
		}
		if(key!=CASH)
			esc_flag = 0;
		switch(key)
		{
			case VOID:							// 退出
				sprintf(buf,"取消");
				break;
				
			case TAB:							// TAB
				sprintf(buf,"TAB");
				break;
			  
			case PAGEUP:						// PAGEUP
				sprintf(buf,"PAGE UP");
				break;

			case PAGEDOWN:						// PAGEDOWN
				sprintf(buf,"PAGE DOWN");
				break;

			case 'Q':							// Q/部门1
				sprintf(buf,"Q/部门1");
				break;

			case BRANCH4:						// 部门4
				sprintf(buf,"部门4");
				break;

			case BRANCH7:						// 部门7
				sprintf(buf,"部门7");
				break;
			  
			case BACK_PAPER:					// 退纸
				sprintf(buf,"退纸");
				break;

			case 'W':
				sprintf(buf,"W/部门2");
				break;

			case 'A':
				sprintf(buf,"A/部门5");
				break;

			case BRANCH8:
				sprintf(buf,"部门8");
				break;

			case PAPER1:
				sprintf(buf,"走纸");
				break;

			case 'E':
				sprintf(buf,"E/部门3");
				break;

			case 'S':
				sprintf(buf,"S/部门6");
				break;

			case 'Z':
				sprintf(buf,"Z/部门9");
				break;

			case 'R':
				sprintf(buf,"R/辅币");
				break;
				
			case 'D':
				sprintf(buf,"D/定金");
				break;

			case 'X':
				sprintf(buf,"X/营业员");
				break;

			case NS :
				sprintf(buf,"开钱箱");
				break;
				
			case 'T':
				sprintf(buf,"T/时间/信用卡");
				break;

			case 'F':
				sprintf(buf,"F/开台/票号");
				break;

			case 'C':
				sprintf(buf,"C/修改");
				break;

			case CLEAR:
				sprintf(buf,"清除");
				break;
				
			case 'Y':
				sprintf(buf,"Y/支票");
				break;

			case 'G':
				sprintf(buf,"G/挂单/退货");
				break;

			case 'V':
				sprintf(buf,"V/PLU");
				break;

			case BACK:
				sprintf(buf,"退格");
				break;

			case 'U':
				sprintf(buf,"U/优惠劵");
				break;

			case 'H':
				sprintf(buf,"H/折让/废票");
				break;

			case 'B':
				sprintf(buf,"B/部门");
				break;

			case '+':
				sprintf(buf,"+/数量");
				break;
				
			case '-':
				sprintf(buf,"-/单价");
				break;
				
			case '*':
				sprintf(buf,"*/加成/入帐");
				break;

			case '/':
				sprintf(buf,"除号/折扣/出帐");
				break;
				
			case '0':
				sprintf(buf,"0");
				break;
				
			case '1':
				sprintf(buf,"1/N");
				break;
				
			case '2':
				sprintf(buf,"2/M/下行");
				break;
				
			case '3':
				sprintf(buf,"3");
				break;
				
			case '4':
				sprintf(buf,"4/J/翻前页");
				break;
				
			case '5':
				sprintf(buf,"5/K");
				break;

			case '6':
				sprintf(buf,"6/L/翻后页");
				break;
				
			case '7':
				sprintf(buf,"7/I");
				break;


			case '8':
				sprintf(buf,"8/O/上行");
				break;

			case '9':
				sprintf(buf,"9/P");
				break;

			case TOTAL:
				sprintf(buf,"合计/+/-");
				break;
				
			case '.':
				sprintf(buf,"小数点");
				break;

		   	case KEY00:    
				sprintf(buf,"00");
				break;

			case CASH:                // 确认
				if(esc_flag)
					return;
				esc_flag = 1;
				sprintf(buf,"现金/确认");
				break;
			default:
				break;
		}
		//keycnt++;
		clear_lcd(y_pos,1);
		/*sprintf(&buf[14],"已检测:");//统计键的个数
		if(keycnt>99)
		 {
          buf[21]=0x30+(keycnt/100);
		  buf[22]=0x30+(keycnt/10);
		  buf[23]=0x30+(keycnt%10);
		 }
		else if (keycnt>9)
		 {
          buf[21]=0x30+(keycnt/10);
		  buf[22]=0x30+(keycnt%10);
		 }
		else buf[21]=0x30+keycnt;
		strcat(buf,"次");
		*/
		lcd_disp(y_pos,0,buf);

		y_pos++;
		if(y_pos==4)y_pos = 0;
			
	}
}


//===================================================
void self_detect_vfd(void)
{
	uchar i,j;
	uchar tempbuf[30];
	clear_lcd(0,MAX_LCD_NUM);
	memset(tempbuf,0,30);
	strcpy(tempbuf,"正在检测VFD...");
	lcd_disp(1,0,tempbuf);
	
	for(i=0;i<10;i++)
	{
		for(j=0;j<12;j++)
			DisplayVFD(j,i);
		delayms(3000);
	}
	for(j=0;j<12;j++)
		DisplayVFD(j,8);
	delayms(3000);
}



//===================================================
void self_detect_lcd(void)
{
	//uint count;
	uchar buf[30];
	Display_allgrass();

    delayms(1000);
	clear_lcd(0,1);
    delayms(1000);
	clear_lcd(1,1);
    delayms(1000);
	clear_lcd(2,1);
    delayms(1000);
	clear_lcd(3,1);
    memset(buf,0,30);
    strcpy(buf,"===欢迎使用税控收款机===");
    lcd_disp(0,0,buf);
	strcpy(buf,"税控发票收款机显示屏检测");
	lcd_disp(1,0,buf);
    memset(buf,0,30);
	strcpy(buf,"===欢迎使用税控收款机===");
    lcd_disp(2,0,buf);
	strcpy(buf,"税控发票收款机显示屏检测");
	lcd_disp(3,0,buf);


	delayms(3000);
		
	clear_lcd(0,MAX_LCD_NUM);
	strcpy(buf,"abcdefghijklmnopqrstuvwx");
	lcd_disp(0,0,buf);
	strcpy(buf,"ABCDEFGHIJKLMNOPQRSTUVWX");
	lcd_disp(1,0,buf);
	strcpy(buf,"abcdefghijklmnopqrstuvwx");
	lcd_disp(2,0,buf);
	strcpy(buf,"ABCDEFGHIJKLMNOPQRSTUVWX");
	lcd_disp(3,0,buf);
		
    delayms(3000);
		
	clear_lcd(0,MAX_LCD_NUM);
	strcpy(buf,"012345678901234567890123");
	lcd_disp(0,0,buf);
	lcd_disp(1,0,buf);
	lcd_disp(2,0,buf);
	lcd_disp(3,0,buf);
	//sleep(1);
	delayms(5000);
    self_detect_vfd();
    delayms(5000);	
}
//=======================================================================
void self_Black_mark(void)
{
	uchar buf[30];
	uchar key_tmp;
	clear_lcd(0,4);
	if(!NO_Paperflg)
	{
		strcpy(buf,"正在找色标......");
		lcd_disp(0,0,buf);
	    find_Black_mark();
	}
	else 
    {
		strcpy(buf,"请注意,缺纸!!\r装好纸后按[确定]键再检!");
		lcd_disp(0,0,buf);
		while(1)
		{
			delayms(50);
			key_tmp =get_key();
			if(key_tmp==PAPER1){Fast_feed_paper_hang(120);}
			if(key_tmp == VOID)
			{
			    strcpy(buf,"取消色标检测");
			    lcd_disp(3,0,buf);
				break;
			}
			if((key_tmp == CASH)&&(!NO_Paperflg))
			{
				clear_lcd(0,4);
				strcpy(buf,"正在找色标......");
				lcd_disp(0,0,buf);
				find_Black_mark();
				break;
			}
		}
	}
	delayms(5000);
}


extern void TestRollPaper();

//=========================================================================
void self_test(void)
{
	uchar key;
	uchar buf[25];
	while(1)
	{
		clear_lcd(0,MAX_LCD_NUM);
		strcpy(buf,"1:CPU     2:色标  3:RAM ");
		lcd_disp(0,0,buf);
		strcpy(buf,"4:存储器  5:LCD   6:键盘");
		lcd_disp(1,0,buf);
		strcpy(buf,"7:打印机  8:钱箱  9:端口");
		lcd_disp(2,0,buf);
		strcpy(buf,"0:卡      .:自动        ");
		lcd_disp(3,0,buf);
		while(1)
		{
			key = get_key();
			if(key != 0)break;
		}
		
        if(key == VOID) break;
          //send_char(key);
		switch(key)
		{
		case '0':
			self_detect_card();
			break;
		case '1':
			self_detect_cpu();
			break;
		case '2':
			self_Black_mark();
			break;
				
		case '3':
			self_detect_ram();
			break;
		case '4':
			self_detect_mem();
			break;
		case '5':
			self_detect_lcd();
			/*do
			{
				key = get_key();
				if(key == VOID)
					break;
				key = 0;
				self_detect_lcd();
				
			}while(1);*/
			break;
			
		case '6':
			self_detect_keyboard();
			break;
			
		case '7':
			self_detect_print();
			do
			{
				key = get_key();
				if(key == VOID)
					break;
				key = 0;
				self_detect_print();
				
			}while(1);
			break;
			
		case '8':
			OpenMomneyBox();
	
			break;
			
		case '9':
			self_detect_com();
			break;
		case '.':
			self_detect_auto();
			break;
		case PAPER1:
			Fast_feed_paper_hang(120);
			break;
			
		case BACK_PAPER:
			back_on_dot(120);
			break;
			
		case NS:
			break;
			
		case PAGEUP:
			break;
		case PAGEDOWN:
			break;
		case TAB:
			break;
			
		default:
			break;
		}
	}
}
/*

void TestCOM()
{
	uchar key;
	do
	{
		key = get_key();
		if(key == VOID)
		break;
		key = 0;
		send_str2(6,"123456");
	}while(1);
	
}*/

⌨️ 快捷键说明

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