Blackrock Microsystems Pro60 Programming Manual Download Page 17

static void SerialWriteString(const char *Data, int Length)

{
DWORD dwError, NumBytesWritten;
unsigned int BytesToPrint;

if (Length == -1)

{
BytesToPrint = strlen(Data);
}

else

{
BytesToPrint = Length;
}

if (!WriteFile (SerialChannel, Data, BytesToPrint, &NumBytesWritten, NULL)) 

// Must be NULL for Windows CE
{
// WriteFile failed. Report error.
dwError = GetLastError();
}

}

// --------------------------------------------------------------------------------------

static int ClosePort(void)

{
if (SerialChannel != INVALID_HANDLE_VALUE)

{
// Close the communication port.
if (!CloseHandle (SerialChannel))

{
return FALSE;
}

else

{
SerialChannel = INVALID_HANDLE_VALUE;
return TRUE;
}

}

return FALSE;
}

// ---------------------------------------------------------------------------

static void PrintCharSet(void)

{
char Buffer[16];
unsigned int Line = 2;

// Print the 'printable' chars
while (Line < 16)

{
unsigned int Row = 0;

while (Row < 16)

{
Buffer[Row] = (Line * 16) + Row;
Row++;
}

SerialWriteString(Buffer, 16);
SerialWriteString("\x0d", 1);
Line++;
}

}

// ---------------------------------------------------------------------------

BOOL DataToPrinter(HWND ParentWindowHandle)

{
const char TextStr0[] = "Hello, Printer! This is a whole load of text which doesn't 

Summary of Contents for Pro60

Page 1: ...Blackroc Pro60 Thermal Printer Programming Manual March 2007 V1 4 ...

Page 2: ...2006 Additional specifications added and form control codes clarified V1 2 January 2007 Added description of setup using the OPD menu system V1 3 March 2007 Added description of storing batch files Clarified graphic commands V1 4 March 2007 Clarified font selection command ...

Page 3: ...Character Spacing Colour 7 6 3 3Print Orientation Density Adjustment 8 1 1 1 Graphic Commands 8 6 3 4Form Control 10 6 3 4 1Control by paper length 10 6 3 4 2Control by Markers 10 6 3 5Batch Files 11 6 3 6Batch Files Description 11 6 4Character Set 12 6 5Example WinCE Application Escape Commands Version 13 6 5 1Source Code 13 7WinCE Printer Driver Programming 17 7 1Example WinCE Application Printe...

Page 4: ...84 Resolution dots mm 8 Resolution dpi 203 Printing width mm 48 Paper width mm 58 Max paper thickness um 80 Paper loading Easy loading Printing speed mm s 60 Paper detection Opto sensor Temperature detection Thermistor Head up or Cover open detection Combined with opto sensor Life reliability 50km Operating temperature C 0 to 50 Operating humidity 20 to 85 non condensing 3 Key Functions NEXT ENTER...

Page 5: ...d down for greater than 3s Retrieval of T1 immediate power down Pressed Pressed Calls OPD menu 4 OPD Menu The Pro60 may be setup by use of the buttons on the front face of the unit By pressing the buttons as instructed by the prompts printed on the paper Various parameters can be set by use of the OPD On Paper Display menus The OPD menu is entered by pressing holding then releasing the ENTER and N...

Page 6: ...nter meets the Bluetooth specification V1 1 class 2 attaining a transmission range of around 10 15m The printer responds to an enquiry scan with BT Printer It can also be accessed directly without a scan by use of its Bluetooth address A BT Connect activates the printer The printer will maintain a connection until it goes in to sleep mode The sleep mode disconnects an active connection and goes in...

Page 7: ...be ignored LF 0A Print the contents of the buffer to the paper and feed one line An immediately following CR will be ignored CR LF 0D 0A Print the contents of the buffer to the paper and feed one line LF CR 0A 0D Print the contents of the buffer to the paper and feed one line Normal characters When the line is full additional characters will cause the text to be printed on the paper and the paper ...

Page 8: ... specified dot on the line ESC R ph pl 1B 52 ph pl Relative TAB forwards or reverse by p pixels where p ph 256 pl p is defined as an integer number and may have positive and negative values 6 3 Formatting Characters 6 3 1 Selecting Character Sizes Command ASCII Command hex Function ESC P n 1B 50 n Select character set n All fonts can be mixed within the same line Set number Char Matrix Chars per L...

Page 9: ...ect after a reset 6 3 3 Print Orientation Density Adjustment Command ASCII Command hex Function ESC D n 1B 44 n Select print orientation With n 0 the printing is displayed in normal orientation the text may be read the right way around if the print mechanism is at the bottom of the page With n 1 the printing may be read the right way around if the print mechanism is at the top of the page ESC Y n ...

Page 10: ...e first graphic line is not delta row graphics ESC g n g1 gn 1B 67 n g1 gn n length of graphics data in bytes g1 gn graphic bytes to be printed MODE 0 Unencoded beginning from left of the paper dot 0 is the MSB in the first byte the dot furthest to the right is the LSB in the nth byte A 1 in the relevant bit position represents a black dot in the line After the nth byte the printer automatically r...

Page 11: ...ed In text mode from left to right the dot on the very right is the LS bit A 1 in the respective bit position of a replacement byte represents a black dot in the line After completing the line the printer will automatically return to character mode Mixing of text and graphics is not possible with delta row 6 3 4 Form Control The printer allows two types of form length control Control by paper leng...

Page 12: ...rm feed feed paper until either a marker is reached or the maximum preset form length is reached ESC o 1B 6F Set the beginning of the page to be the current position This command sets the internal form length counter to zero ESC p distance flags 1B 70 m n Parameter m represents the distance between the marker and the tear off position in 0 5mm increments Parameter n defines the form control method...

Page 13: ...ey contain firmware status serial numbers etc TA Reserved TQ Firmware Identifier TR Reserved TS Reserved Batch File Commands Command ASCII Command hex Function ESC T x 1B 54 x Print batch file from store x x 0 9 A Q R S ESC n count data 1B 6E n data Send a string back to the host This command can be used to cause the contents of the batch file to request further data from the host Example If T2 ha...

Page 14: ... documentation pack and is provided in source and compiled form A suitable project file is also supplied to enable the code to be compiled using Microsoft Embedded Visual C 4 0 eVC4 eVC4 is available for free download from Microsoft s internet site 6 5 1 Source Code include Windows h include resource h include string h define SERIAL_PORT L COM7 define ERROR_TEXT TEXT Error static HANDLE ReadThread...

Page 15: ...Display the data read if BytesTransferred 1 ProcessSerialChar Byte while BytesTransferred 1 return 0 int OpenPort HWND ParentWindowHandle DWORD dwError DCB PortDCB COMMTIMEOUTS Timeouts DWORD ThreadID SerialChannel CreateFile SERIAL_PORT GENERIC_READ GENERIC_WRITE 0 NULL OPEN_EXISTING 0 NULL If it fails to open the port return FALSE if SerialChannel INVALID_HANDLE_VALUE Could not open the port Mes...

Page 16: ...outs SerialChannel Timeouts These timeout values have been changed 2007 04 10 Timeouts ReadIntervalTimeout 50L Specify time out between character for receiving Timeouts ReadTotalTimeoutMultiplier 5L Specify value that is multiplied by the requested number of bytes to be read Timeouts ReadTotalTimeoutConstant 5000L Specify value is added to the product of the ReadTotalTimeoutMultiplier member Timeo...

Page 17: ...t ClosePort void if SerialChannel INVALID_HANDLE_VALUE Close the communication port if CloseHandle SerialChannel return FALSE else SerialChannel INVALID_HANDLE_VALUE return TRUE return FALSE static void PrintCharSet void char Buffer 16 unsigned int Line 2 Print the printable chars while Line 16 unsigned int Row 0 while Row 16 Buffer Row Line 16 Row Row SerialWriteString Buffer 16 SerialWriteString...

Page 18: ...WriteString x1b x4c x31This is underlined x0d 22 SerialWriteString x1b x4c x30This is normal x0d 18 SerialWriteString Form feeding x0dlooking for mark x0d 1 SerialWriteString x0C 1 SerialWriteString After form feed x0d 1 Sleep 1000 ClosePort return TRUE 7 WinCE Printer Driver Programming The Pro60 is supplied with a suitable driver for WinCE This driver is presently available for devices based upo...

Page 19: ...DOCINFO DocInfo DWORD dwJob DEVMODE DeviceMode HDC PrinterDC int xPage yPage static wchar_t TextStr L Hello Printer This is a whole load of text which doesn t really mean anything It is used only to test the printout The last try was not long enough so I have to type some more This much text should make sure we see wraps at the end of the lines RECT Box HANDLE BitmapHandle HDC MemoryDC BITMAP Bitm...

Page 20: ... PrinterDC 0 0 NULL LineTo PrinterDC xPage yPage MoveToEx PrinterDC xPage 0 NULL LineTo PrinterDC 0 yPage Define a bounding box and output some text Box left xPage 30 Box right xPage Box left Box top 2 yPage 8 Box bottom 6 yPage 8 Rectangle PrinterDC Box left Box top Box right Box bottom SetTextAlign PrinterDC TA_LEFT TA_TOP DrawText PrinterDC TextStr 1 Box DT_LEFT DT_WORDBREAK Copy a bitmap image...

Page 21: ...DeleteObject BitmapHandle return TRUE ...

Page 22: ...n Windows CE net 4 2 Initial Screen select Control Panel Select Power Properties Select the Built in devices tab and enable Bluetooth Select Bluetooth Device Properties Press the Scan button Wait for the Bluetooth scanning to complete ...

Page 23: ...Locate the device BT Printer Double click ASYNC Select Active The device should now show its active serial port ...

Page 24: ...Windows Mobile 2003 ...

Page 25: ......

Page 26: ...Alphabetical Index ...

Reviews: