Go Premium for a chance to win a PS4. Enter to Win


Sending a pulse to the printer port

Posted on 2000-04-04
Medium Priority
Last Modified: 2008-02-20
 Can you help me,
  I am currently working on a simple Point of sale for my hairdressing salon.
  I am using Delphi 3.I have a reciept printer ( POS transaction printer ) and a cash drawer.
  The Cash drawer is connected to the POS printer and when I print a reciept or send a job to
  the printer the cash drawer opens by recieving a command from the printer.This is not good
  because anyone can open the cash drawer by printing from NOTEPAD.I am attaching a file
  to this EMail, open it and you will know that it is possible for me to change drivers so that the cash
  drawer does not open when the reciept printer is printing.It is possible for me to open the cash
  drawer by sending signals to the reciept printer.This I do know how to do.
 Below is a note from the vendor of the printer about sending signals to the printer but I do not how
 to use it in Delphi.
         Generate Cash drawer pulse.
         Generates a pulse to the cash drawer output if reciever at the begining of a line.
         if f = 0 or 48 the first cash drawer on pin 2 is activated and if f = 1 or 49 the second cash
         drawer on pin 5 is activated.
          Hexadecimal 1B 70 f m n
          Decimal         27 112  f m n
          ASCII            ESC p f m n
          values           f = Cash drawer select
                              m = Cash drawer on time
                              n = Cash drawer off time
          Rangers  :     Hexadecimal f = 00,01,30,31
                                                        m _< n = 00 - ff
                              Decimal  f = 0,1,48,49
                                            m _< n = 0 - 255
Related information : Both cash drawer on and off time values are multiplied by 2ms to
determine the pulse time.the off time should be greater than the on time. If the downloaded on time is greater then the off time,the off time will be increased to match the on time.
Installation and operation guide that came with the printer
Cash Drawer.
There is a single cash drawer driver with sense using an RJ-11 connector.This device
is designed for use with Epson compatible cash drawers.Thedriver supplies 24v dc
with maximum current of 1 amp.the coil resistance in the cash drawer must be no less
than 24 ohms or damage to the printer will result.Refer to the programming
manual for <ECS> p command usage.
Pin #         Signalname             Signal Source       Discription
1               CHASISS GND        -                          Chasis ground              
2               DRIVE                   Printer                  cash drawer drive. This pulse length is based
                                                                          on the 'ESC p' Command.
3               SENSE                  Cash Drawer         Cash drawer sense returned to the host
                                                                          with the 'ECS u' command.This pin should be pulled
                                                                          up by the printer.    
4               + 24 VDC               Printer                  
5               N/C                         -                          No Connection
6               SIGNAL GROUND    Printer                  Signal ground
Question by:tdecruz

Expert Comment

ID: 2682852
On Torry.ru there are 2 components that let you send data to the printer ports


TDLPortIO v1.2: DriverLINX Win95/98/NT Port IO driver wrapper.
TDLPortIO is (c) 1999 John Pappas (DiskDude).
DriverLINX is (c) 1996 Scientific Software Tools, Inc.

This package allows read/write of IO ports in Win95/98/NT.

   o C++ Builder 3/4 VCL component
   o Delphi 3/4 VCL component
   o ActiveX (OCX) control (for Visual BASIC)
   o DLL version equivalent
   o All source code
   o Quick Windows NT System Admin driver installer
   o Examples (project sources)
   o Compatibility with the TVicPort shareware package


Email: diskdude@poboxes.com
WWW:   http://diskdude.cjb.net/

and smallport

SmallPort Delphi Component.

Thank you for trying SmallPort Component.

This component allows you to reach hardware ports using  "smport.vxd" driver with Win95/98.
It works a little bit faster and stable than regular assembler commands, that they usual use to reach h/w ports in Win95/98.

To install this component use Component >>Install Package>>Add>> HWTool4.bpl-for Delphi4 or HWTool3.dll-for Delphi3.
For Delphi2 use Component >>Install Component>>Browse>> \\..\SmallPort.pas
Copy file "smport.vxd" to Windows\System directory or to directory of your application.
Put component on your form and set property Opened to true. SmPort will open driver and now is ready to perform I/O operations. If you see message, that it's impossible to open driver, it means that driver is not in
application's folder and not ii System folder. Fix it and try again.

 Opened - read/write : boolean : open and close "smport.vxd".
 DriverHandle -read only : boolean: handle of driver.
 IOResult : read only: boolean :true if last I/O operation successful.
 Port : read/write : array: implementation Pascal array Port[portaddress].

Please direct all correspondence to  Alexander Weitzman at: mailto: alweit1@hotmail.com

I hope these components can help you read/write the printer ports :-)


Accepted Solution

mullet_attack earned 100 total points
ID: 2683477
Seems to me all the info is there. I gather your cash draw is connected to a port on the printer, _not_ directly to the PC's printer port. in this case, the above printer port drivers are overkill and you should be able to
just print the string '#27#112#f#m#n' using standard delphi printer commands

where f = 0 or 48 for cash draw one
   or f = 1 or 49 for cash draw two

the m and n values will depend on the pulse widths required by your particular cash drawer (look in the manual!)  

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question