Updated 1-19-17
Adding a cash drawer function to your software.
From the email I have received it seems as though I have been selected as the global internet source for information about opening cash drawers. Weeeeee, what fun!

Well I guess that it had to be somebody, it may as well be me. Just can anyone tell me how I got picked?

Basic cash drawers, 101
The purpose of this page is to help you add computer code to your software to allow it to open cash drawers. I do not know what language you program in and unless it is QuickBASIC (the only language that I know) I cannot help you write code for your program. The information on this page is to help you write the computer code in your program to open cash drawers.

What is being discussed here are cash drawers that hold money, coins / bills, that are electronically opened by a cash register. Specifically this is about cash drawers that are attached to standard personal computers that are running cash register software. If you are interested in cash drawers that are part of special purpose cash registers then you will have to contact the manufacturer.

There are two basic kinds of cach drawers, those that attach to a computer's serial port using a serial cable and those that attach to a receipt printer using special cable

Cash drawers connected to a printer.
Cash drawers that have a cable that are to be plugged into receipt printers that have a port for this cable, which is pretty much all receipt printers. Regular computer printers will not have this port.

By "receipt printer" I do not mean any printer that you may be using to print receipts. Receipt printers are specifically designed to print receipts, will usually print only 40 characters (or less) per line, print from rolls of paper, and most importantly for our purposes here, will have the socket to plug in the cash drawer cable.

NOTE, Some cash drawer cables have a plug that looks like a "phone" plug and may actually plug into a port on your computer. However the port on your computer IS NOT a cash drawer port. It is more likely either an actual port for a phone or an ethernet connection. Also different brands of receipt printers may have different cash drawer ports. If (for example) you have an Epson receipt printer your cash drawer must have an Epson type cable. If you have an Ithaca printer your cash drawer must have an Ithaca type cable. And so on.

It is the receipt printer that sends the signal to the cash drawer for it to open. This means that you must send a code to the printer that is specific to the PRINTER to tell it to open the cash drawer. Look on this page "Cash drawer codes" to find the "open cash drawer" codes for specific printers.

Of course for a printer to open a cash drawer the printer has to be working. If your printer is not printing receipts when it is told to do so, it will not open the cash drawer either even if the proper control code is sent. Make sure that your printer is working.

When you send data to a printer the printer's first inclination is to print it. After all this is what printers do. However in many cases you want to tell the printer to do something, to change a font, underline, open the cash drawer, etc. To let the printer know that it is receiving instructions instead of text to print you send a "control code" to the printer which usually begins with the ASCII character 27 (in decimal) or 1B (in hexadecimal). When the printer receives the character 27 says to itself, "Oh crap, I have to wake up and do something, not print."

First a little background. Text information is exchanged with printers in what is called ASCII code. This means that when you send a string of text to a printer that the text is converted to ASCII code and then it is the code that is actually transmitted. For example if you wanted to send DALE to a printer it would actually be sent as the ASCII codes 68, 65, 76, 69. Every letter, number, puncuation mark, and symbol has a ASCII code assigned to it. Plus there are other things that are also included. In total there are 256 ASCII codes. (I do know that there is more to ASCII codes than that but for the purpose here that is enough information. So please do not send to me a 9 page email explaining extended ASCII codes et. al. because I already know about that stuff and it would just confuse the issue anyway, thanks.)

To see this work try this. Go to your word processing software. Hold down the [ALT] key and on the numeric key pad at the right of your keyboard type 72 then release the [ALT] key. Do the same thing with the numbers 69, 76, 76, and then 79. Kind of neat, isn't it.

Computers will automatically convert strings of text to ASCII to send it to the printer. This means that if you know the ASCII code you want to send to the printer you must first convert it to a string of text. When your computer then is told to send the string of text to the printer it will convert it back to ASCII code first. Gee, how pointless is that, but that is the way it works.

This is not easy and is different for every programming language. Since the only programming language I know is BASIC here is the BASIC code for doing this.

Let's assume that the control code you must send to your printer to have it open your cash drawer is 27,112,0,50,250.

First you must convert it into a string using this BASIC code...

POPOPEN$ = CHR$(27) + CHR$(112) + CHR$(0) + CHR$(50) + CHR$(250)

Now all you have to do to open your cash drawer (assuming that your printer and cash drawer are properly connected and turned on) is to send the string to the printer using...


If this does not work then you can test your program code by changing the control code to 65, 66, 67, 68, 69. This is not intended to try to open the cash drawer but will instead print ABCDE on your printer. If ABCDE is not printed then either your printer is not connected properly, or your computer code for creating the string and then sending it to the printer is incorrect.

To test your printer setup, load your word processing software, type in some text, and then print it. Event though it is a receipt printer this test will print if your printer is properly set up and Windows is configured to your printer. If ABCDE is printed but when you send your "pop open" code your drawer does not open then either your cash drawer is not set up correctly or the "pop open" code you are using is incorrect.

It is also possible (another programmer, another program, magic) to store the ASCII string with the codes you need to a computer file. Then all you have to do is to read the file into a string variable and then print the string to your printer.

If the program you are writing will be required to be able to make several different printers open a cash drawer then you have to either have a way for the user to enter in the proper "open cash drawer" code for a specific printer or you will have to have all possible codes in your software and the user will then be able to select the printer.

Cash drawers connected to a computer's serial port.
First of all my usual rant against serial devices...

Serial devices are the bane of human existance and will undoubtablly be responsible for the extinction of all life on earth. Accessing the serial port is an iffy proposition at best and in many cases will not work at all.

That said I do realize that many applications will require the use of a serial cash drawer. The main reason for using a serial cash drawer is if the POS application uses a regular computer printer instead of a receipt printer or if the application does not use a printer at all. A regular computer printer will not have a port to plug in a cash drawer.

On most serial cash drawers if any output is sent to the serial port to which the cash drawer is connected, the cash drawer will open. However you may first have to configure the port with the speed, parity, data bits, stop bits, etc. that your cash drawer will require to allow it to receive the signal. Look in the cash drawer's manual for this information.

My POS software uses 6 .BAT files SERIAL1.BAT SERIAL2.BAT SERIAL3.BAT SERIAL4.BAT SERIAL5.BAT SERIAL6.BAT and the program file CDK.EXE to attempt to open serial cash drawers. You may download this file to obtain those files CDK.ZIP. You must unzip / extract CDK.ZIP for the files contained in it to be usable.

The files SERIAL1 to SERIAL3 will attempt to open a cash drawer attached to the COM1 serial port and SERIAL4 to SERIAL6 will attempt to open a cash drawer attached to the COM2 serial port. Files SERIAL3 or SERIAL6 will require the CDK.EXE file and the others will not. It may be possible to use the CDK.EXE file without the SERIAL?.BAT files as long as you specify the COM port. (Examine the contents of the SERIAL3.BAT file to see how this is done.) By changing the contents of the SERIAL?.BAT files you may be able to specify COM ports other than COM1 or COM2.

For your software to utilize either one of the SERIAL?.BAT files or the CDK.EXE file your program must RUN one of those files.

In my POS software I have a function that lets the user try out the open cash drawer options one at a time until one works. then the user can setup the program to use that option.

The program file CDK.EXE was written Jonathan Simpson, many thanks.

Click on [BACK] on your web browser to return to the previous page, or