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

📄 epp.c.txt

📁 HP1150/1160等系列的打印机 并口驱动程序 打印机语言是PCL5e
💻 TXT
📖 第 1 页 / 共 3 页
字号:
			 esc,'&','r','0','F',	// flush all pages command
			 esc,'*','l','1','R',	// pixels placement
			 esc,'&','u','6','0','0','D',	// meaure units
			 esc,'&','l','0','o',	// logical page orientation
			 esc,'&','l','7','H',	//  paper source (0)
			 esc,'&','a','0','P',	// text orentation
			 esc,'&','l','2','6','A',	// select page size (a4) 40
			 
			 esc,'&','l','1','X',	// copies
			 
			 esc,'&','l','0','u','0','Z',
			 esc,'&','l','0','E',	// top margin
			 esc,'*','p','3','x','1','4','Y',	// position the cursor
			 esc,'*','p','0','R',	// pattern reference point
			 esc,'*','c','5','6','1','2','x','1','1','1','7','7','Y',	// image size
			 esc,'*','p','0','x','1','0','0','Y',	//postion the cursor
			 esc,'*','c','0','T',	// set the top left corner(start point) to the current point(0,100)
			 esc,'*','a','0','p',	// text orentation
			 esc,'%','0','A',	// enter pcl mode--use the previous pcl course position
			 esc,'*','l','2','0','4','O',	//logical orentation
			 esc,'*','v','1','n','1','O',	// image transparency
			 esc,'*','v','1','T',	// pattern type126
			 	
			 esc,'*','p','9','5','0','x','0','8','0','0','Y',	// position the cursor 138
			 
			 esc,'*','t','6','0','0','R',	// resolutioN_Report45
			 
			 esc,'*','r','0','F',		// IMAGE orentation
			 esc,'*','r','4','8','0','0','S',	// image width158
			 esc,'*','r','1','A',	// start raster
			 esc,'*','b','0','M'	// copression mode 168
		};
	//#else
	/*
			unsigned char PrinterCommand_PCL[168] = 
		{
			 esc,'E', 	// reset escE
			// esc,'*','p','9','9','9','x','2','2','5','1','Y',
			 esc,'&','r','0','F',	// flush all pages command
			 esc,'*','l','1','R',	// pixels placement
			 esc,'&','u','6','0','0','D',	// meaure units
			 esc,'&','l','0','o',	// logical page orientation
			 esc,'&','l','7','H',	//  paper source (0)
			 esc,'&','a','0','P',	// text orentation
			 esc,'&','l','2','6','A',	// select page size (a4) 40
			 
			 esc,'&','l','1','X',	// copies
			 
			 esc,'&','l','0','u','0','Z',
			 esc,'&','l','0','E',	// top margin
			 esc,'*','p','3','x','1','4','Y',	// position the cursor
			 esc,'*','p','0','R',	// pattern reference point
			 esc,'*','c','5','6','1','2','x','1','1','1','7','7','Y',	// image size
			 esc,'*','p','0','x','1','0','0','Y',	//postion the cursor
			 esc,'*','c','0','T',	// set the top left corner(start point) to the current point(0,100)
			 esc,'*','a','0','p',	// text orentation
			 esc,'%','0','A',	// enter pcl mode--use the previous pcl course position
			 esc,'*','l','2','0','4','O',	//logical orentation
			 esc,'*','v','1','n','1','O',	// image transparency
			 esc,'*','v','1','T',	// pattern type126
			 	
			 esc,'*','p','0','8','0','x','0','5','0','0','Y',	// position the cursor 138
			 
			 esc,'*','t','3','0','0','R',	// resolutioN_Report45
			 
			 esc,'*','r','0','F',		// IMAGE orentation
			 esc,'*','r','4','8','0','0','S', // image width158
			 esc,'*','r','1','A',	// start raster
			 esc,'*','b','0','M'	// copression mode 168
		};
	#endif
*/
	for( i = 0; i < 57; i ++ )	{  SppWrite( PrinterCommand_PJL[i] );	}
	for( i = 0; i < 43; i ++ )	{  SppWrite( PrinterCommand_PCL[i] );	}
	SppWrite(Copies+48);
	//for( i = 44; i < 142; i ++ )	{  SppWrite( PrinterCommand_PCL[i] );	}
	for( i = 44; i < 129; i ++ )	{  SppWrite( PrinterCommand_PCL[i] );	}
	
	if(style == 0)	
	{
		SppWrite('9');
		SppWrite('5');
		SppWrite('0');
		SppWrite('x');
		SppWrite('0');
		SppWrite('8');
		SppWrite('0');
		SppWrite('0');
		SppWrite('Y');
		SppWrite(esc);
		SppWrite('*');
		SppWrite('t');
		SppWrite(6+48);	
		
	}
	else 	
	{
		SppWrite('0');
		SppWrite('8');
		SppWrite('0');
		SppWrite('x');
		SppWrite('0');
		SppWrite('5');
		SppWrite('0');
		SppWrite('0');
		SppWrite('Y');
		SppWrite(esc);
		SppWrite('*');
		SppWrite('t');
		SppWrite(Resolution+48);
	}
	for( i = 142; i < 153; i ++ )	{  SppWrite( PrinterCommand_PCL[i] );	}

	if(style == 0)
	{ 
		SppWrite(N_Image*SCREENW/1000+48);
		SppWrite((N_Image*SCREENW%1000)/100+48);
		SppWrite((N_Image*SCREENW%100)/10+48);
		SppWrite(N_Image*SCREENW%10+48); 
	}
	else
	{
		SppWrite(N_Report*REPORTWIDTH/1000+48);
		SppWrite((N_Report*REPORTWIDTH%1000)/100+48);
		SppWrite((N_Report*REPORTWIDTH%100)/10+48);
		SppWrite(N_Report*REPORTWIDTH%10+48);
	}

	for( i = 157; i < 168; i ++ )	{  SppWrite( PrinterCommand_PCL[i] );	}
	
}
/****************************************************/ 
/*** 				Send_Data()                                  ***/
/*** 			send data to the printer			          ***/
/****************************************************/ 
void SendData_I()
{
	int i, j, x, y, a, b;
	unsigned char temp, data = 0;
	int width, height;

	//char a, b, c;

	width = SCREENW * N_Image;
	height = SCREENH * N_Image;
	
	for(j = 0; j < height; j ++)
	{
		// command of sending data to printer
		SppWrite( esc);
		SppWrite( '*' );
		SppWrite( 'b' );
		SppWrite( (width/8)/100 + 48 );
		SppWrite( (width/8%100)/10 + 48 );
		SppWrite((width/8)%10 + 48);
		SppWrite( 'W' );
		

		for(i = 0; i < width; i ++)
		{
			y = j / N_Image;		x = i / N_Image;	
			b = j % 16;	a = i % 16;
			temp =  ScreenBuffer1[SCREENW*y + x];
			
			if ( temp < dither[b][a])
				data |= 0x80 >> (i % 8);
			if( (i % 8) == 7)
			{
				SppWrite(data);
				data = 0;
			}
		}
	}
}

void SendData_R()
{
	int i, j, x, y, a, b;
	unsigned char temp, data = 0;
	int width, height;

	width = REPORTWIDTH * N_Report;
	height = REPORTHEIGHT * N_Report;

	for(j = 0; j < height; j ++)
	{
		// command of sending data to printer
		SppWrite( esc);
		SppWrite( '*' );
		SppWrite( 'b' );
		SppWrite( width /8/100 + 48);
		SppWrite( ((width /8)%100)/10 + 48);
		SppWrite( (width /8)%10 + 48);
		SppWrite( 'W' );
		
		for(i = 0; i < width; i ++)
		{
			y = j / N_Report;		x = i / N_Report;	
			b = j % 16;	a = i % 16;

			temp =  ReportBuffer[REPORTWIDTH*y + x];
			
			if ( temp > dither[b][a])
				data |= 0x80 >> (i % 8);
			if( (i % 8) == 7)
			{
				SppWrite(data);
				data = 0;
			}
		}
	}
}

/****************************************************/ 
/***     			 Print_Peremeter			 		   ***/
/***              client select peremeter of print                      ***/
/****************************************************/
/*
void Print_Peremeter(void)
{
	volatile unsigned char key; 
	unsigned char end = 0, input = 0;
	unsigned char  StringResolution1[2][30]={{"1 ----- 600 dpi" },{"1 ----- 600 dpi" }};
	unsigned char  StringResolution2[2][30]={{"2 ----- 300 dpi" },{"2 ----- 300 dpi" }};
	unsigned char  StringEsc[2][20]={{"Esc - Exit" },{"Esc - 退出" }};
	unsigned char  StringError1[2][40]={{"Please Input the copies less than 10:" },{"请输入小于10 的打印份数:" }};	
	char  StringCopy[2][50]={{"I - Input the copies" },{"I - 输入打印的份数" }};
	char  StringResolution[2][30]={{"S - Select resolution" },{"S - 选择打印分辨率" }};
	char stringInfo1[20];
	char stringInfo2[20];
	
	extern volatile unsigned char  Key_Done;
	extern volatile unsigned char  Key_Val;	
	extern volatile unsigned char  Language;
	extern volatile unsigned char  InputString[100];

	sprintf(stringInfo1,"(%d)", Copies);
	sprintf(stringInfo2,"(%d00 dpi)", Resolution);

	strcat(StringCopy[Language],stringInfo1);
	strcat(StringResolution[Language],stringInfo2);
	
	CreateMune (100, 50, 380, 85, StringCopy[Language]);       
	CreateMune (100, 85, 380, 120, StringResolution[Language]);   
	CreateMune (100, 120, 380, 155, StringEsc[Language]);  

while(!end)
{
	Display_Rtc(Date_Type);
	
	if(Key_Done == 1)
	{
		Key_Done = 0;	key = Key_Val;
		switch(key)
		{
			case 'i':
			case 'I':// input the copies
			case KEYIF1:
			case KEYIF2:
				Glib_FilledRectangle(100, 50, 380, 155, 0);
				while(input == 0)
				{
					PutString(200, 530, StringError1[Language], 0);
					if (InputBlock(300, 550, 400, 570, 0)==0x0e) 
					{
						Copies = InputString[0]-48;
						if( (Copies > 0) && (Copies <= 9))
						{
							Glib_FilledRectangle(200, 510, 500, 570, 0);
							input = 1;	
						}
					}
				}		
				end = 1;
				break;

			case 's':
			case 'S':
			case KEYSF1:
			case KEYSF2:
				//select resolution
				CreateMune (380, 85, 550, 120, StringResolution1[Language]);       
				CreateMune (380, 120, 550, 155, StringResolution2[Language]);
				while(!input)
				{
					Display_Rtc(Date_Type);
					if(Key_Done == 1)
					{
						Key_Done = 0;	key = Key_Val;
						switch(key)
						{
							case '1':
							case KEY1F1:
							case KEY1F2:
								Resolution = 6;
								Glib_FilledRectangle(100, 50, 550, 155, 0);
								input = 1;	end = 1;
								break;
								
							case '2':
							case KEY2F1:
							case KEY2F2:
								Resolution = 3;
								Glib_FilledRectangle(100, 50, 550, 155, 0);
								input = 1;	end = 1;
								break;

							default:
								break;
						}
					}
				}
				break;

			case 0x0e:
				Clear_Display();
				end = 1;
				break;

			default:
				break;
		}
		
	}
}
	

}
*/

/**************************************************** 
    			 GUI   							   
 void  PutPixel_Print(U32 x0,U32 y0,U16 gray,U8 m)	  
 
function: write the dot of raster image
x,y: 		corrdinate of the dot
gray: 		gray of the dot
m: 		multiple 
notice: 	this function can control the size of the font by n
**********************************************/

void  PutPixel_Print(U32 x0,U32 y0,U16 gray,U8 m) 
{
    unsigned char i, j ,c;
    int x, y;
    
    c = gray;    
    x = x0;
    y = y0;
    
    if(x<(REPORTWIDTH/m)&& y<(REPORTHEIGHT/m))   
    {    
    	for(j=0; j<m; j++)
    	{
    		for(i=0; i<m; i++)
    		{
    			ReportBuffer[ (m*y+j)*REPORTWIDTH + m*x+i] = c;
    		}
    	}
    }        
}

/**************************************************** 
    			 GUI   							   
void  Putchar_Print ( int x, int y, unsigned char s, U8 m)	

function: write a char to the raster image
x,y: 		corrdinate of the dot
s: 		ASCII of the char
m: 		multiple 
**********************************************/
void  Putchar_Print ( int x, int y, unsigned char s, U8 m)
{
	U16  i, j, k, c1, c2;	  
	U8 *put_char;
	
	put_char = asc16[s];	
	for (j=0;j<=15;j++)
	{
		k=128;
		for (i=0;i<=7;i++)  
			{ c1=((*put_char) & k);  c2 = ( c1 == 0 ? 0: 250 );  k = k >> 1; PutPixel_Print(x+i,y+j, c2, m); }
		put_char++;      
	}   	
}

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

⌨️ 快捷键说明

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