CBM-1000 II printer and communication with C# 2.0
-
Hi all. I cant understand what`s wrong in my code... I`ve got "Command Reference" of Citizen CBM-1000 II Line thermal printer. For example, cutting the paper:
[Command] (1) GS V m .......
[Command] (2) GS V m n .....
[Function] Cutting the paper
[Code] (1) <1D>H<56>H
(2) <1D>H<56>H
[Range] (1) m = 1, m = 49
(2) m = 66
0 <= n <= 255
[Outline] Performs the specified paper cutting.
Value of 'm' ---- Function
1 or 49 ---- Partial cut (Leaving a bridge area uncut)
66 ---- Paper feed by “cut position + {n ´ basic calculation
pitch}”and partial cut (Leaving a bridge area uncut)Here`s my code (C# 2.0):
SerialPort printer = new SerialPort("COM4"); printer.Open(); byte[] buffer = new byte[3] { 0x1D, 0x56, (byte)1 }; printer.Write(buffer, 0, 3); // printer.Write("GS V 1"); printer.Close();
Printer do not cut the paper. Just printing some symbols... What`s wrong here ? Please help. -
Hi all. I cant understand what`s wrong in my code... I`ve got "Command Reference" of Citizen CBM-1000 II Line thermal printer. For example, cutting the paper:
[Command] (1) GS V m .......
[Command] (2) GS V m n .....
[Function] Cutting the paper
[Code] (1) <1D>H<56>H
(2) <1D>H<56>H
[Range] (1) m = 1, m = 49
(2) m = 66
0 <= n <= 255
[Outline] Performs the specified paper cutting.
Value of 'm' ---- Function
1 or 49 ---- Partial cut (Leaving a bridge area uncut)
66 ---- Paper feed by “cut position + {n ´ basic calculation
pitch}”and partial cut (Leaving a bridge area uncut)Here`s my code (C# 2.0):
SerialPort printer = new SerialPort("COM4"); printer.Open(); byte[] buffer = new byte[3] { 0x1D, 0x56, (byte)1 }; printer.Write(buffer, 0, 3); // printer.Write("GS V 1"); printer.Close();
Printer do not cut the paper. Just printing some symbols... What`s wrong here ? Please help.You probably have to set the printer to a special mode that interprets the data instead of printing it. This could either be done by setting a pin, sending a special sequence or changing a setting on the printer manually.
-
You probably have to set the printer to a special mode that interprets the data instead of printing it. This could either be done by setting a pin, sending a special sequence or changing a setting on the printer manually.
I did it ! :) ;P :laugh: But from code:
SerialPort p = new SerialPort("COM1", 19200, Parity.None, 8, StopBits.One); p.Open(); Stream s = p.BaseStream; byte[] buff = new byte[7] { 0x1D, 0x28, 0x41, (byte)2, (byte)0, (byte)2, (byte)2 }; s.Write(buff, 0, 7); s.WriteByte(0x1d); s.WriteByte(0x28); s.WriteByte(0x31); s.Close(); p.Close();
This basic code will print test page and then cut the paper.