圖片:
圖片:
圖片:
圖片:
圖片:
應用介紹:用西門子PLC通過以太網(wǎng)TCP/IP協(xié)議控制東芝打印機打印二維碼
1.設置打印機的IP地址和端口號:只能通過BCPToolSetupFull.exe軟件設置,用USB線或網(wǎng)線連接(知道IP的情況下)
2.設置命令格式:[ESC][LF][NUL]
下面為PLC給打印機發(fā)送的程序程序
[ESC]D0530,0600,0500[LF][NUL]
[ESC]AX;-000,+000,-00[LF][NUL]
[ESC]AY;+05,0[LF][NUL]
[ESC]T00C60[LF][NUL]
[ESC]C[LF][NUL]
[ESC]PC001;0060,0080,1,1,C,00,B;01[LF][NUL]
[ESC]PC002;0060,0130,1,1,C,00,B;02[LF][NUL]
[ESC] XB01; 0060, 0420, Q, 08, 08, 05, 3 ;01[LF] [NUL]
[ESC]RC;SSSSSSSSSS[LF]ABBBBBBB[LF][NUL]
[ESC]XS;I,0001,0000C6000[LF][NUL]
3.命令格式介紹:
除了首尾[ESC][LF][NUL] 用ASCII碼,16進制表示,其它都以字符形式發(fā)送。如第一行:[ESC]D0530,0600,0500[LF][NUL]
PLC端應發(fā)送如下:是我用STL語言寫的發(fā)送格式;"D_0194_Printer_Data".SEND是發(fā)送緩存區(qū)。直接關聯(lián)發(fā)送指令(T_SENDC)的數(shù)據(jù)。然后發(fā)送給打印機
L B#16#1B
T "D_0194_Printer_Data".SEND[0]
L 'D'
T "D_0194_Printer_Data".SEND[1]
L '0'
T "D_0194_Printer_Data".SEND[2]
L '5'
T "D_0194_Printer_Data".SEND[3]
L '3'
T "D_0194_Printer_Data".SEND[4]
L '0'
T "D_0194_Printer_Data".SEND[5]
L ','
T "D_0194_Printer_Data".SEND[6]
L '0'
T "D_0194_Printer_Data".SEND[7]
L '6'
T "D_0194_Printer_Data".SEND[8]
L '0'
T "D_0194_Printer_Data".SEND[9]
L '0'
T "D_0194_Printer_Data".SEND[10]
L ','
T "D_0194_Printer_Data".SEND[11]
L '0'
T "D_0194_Printer_Data".SEND[12]
L '5'
T "D_0194_Printer_Data".SEND[13]
L '0'
T "D_0194_Printer_Data".SEND[14]
L '0'
T "D_0194_Printer_Data".SEND[15]
L B#16#0A
T "D_0194_Printer_Data".SEND[16]
L B#16#00
T "D_0194_Printer_Data".SEND[17]
4.調(diào)試過程中如果打印機報錯,一般是發(fā)送數(shù)據(jù)指令格式不準確;蛏侔l(fā)送了字符。
5.好了