Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trigger Cash Drawer

Status
Not open for further replies.

Newtonm

Programmer
Nov 8, 2001
39
0
0
CA
We have a POS application which triggers a cash drawer using the code
SET CONSOLE OFF
SET DEVICE TO PRINT
SET PRINTER TO
??? CHR(27)+CHR(112)+"0,48"
This works fine in 95/98 but crashes in 2K and XP with a GPF 0001:222D. We have tried using only "??" but this does nothing. Does anyone know how to send the required Escape sequence to the port to trigger the cash drawer. Printer is an Epson TM-U200PD and has RJ6 outlet to connect to drawer.
Alternatively we wonder if there is a setting of the 2 dips to automatically trigger drawer when printer fires. Unfortunately client has mislaid manual (so what else is new HUH!!)


Richard Myers
Four Letter Software Inc.
 
Richard,
What is your default printer associated with? i.e. What printer driver? What port?

Does the crash happen immediately or when you send the next SET PRINTER TO to flush the Windows spooler?

Rick
 
Hi Rick:
The driver is a Generic/Text Only on LPT1

Crashes on the "???" line which if changed to "??" does NOT crash BUT doesn't do anything either.

RM


Richard Myers
Four Letter Software Inc.
 
You must SET PRINTER TO LPT1.
set device to printer
send the code
??? CHR(27)+CHR(112)+"0,48"
or better
??? CHR(27)+CHR(112)+chr(0)+chr(48)

There is one more problem, XP MUST spool for a default 15 seconds. This can be changed to 1 second (see "FPW2.6 printing on XP" thread in this forum.
You may need to install a generic dot matrix on LPT1 (I don't).
Ken F
 
Sorry Ken: That doesn't work either. It seems that XP has an inherent dislike of "???". I note from the xp printing thread that you use a serial port BUT we are using a parallel port is this significant? And if so how do you suggest we change it??


Richard Myers
Four Letter Software Inc.
 
I use ??? on XP. Never had a problem.
Did you change spooling from 15 to 1 sec?
Did you try using all chr()?
For instance, I use...
??? chr(27)+chr(112)+chr(0)+chr(125)+chr(250)
to open a drawer attached to an Epson 210d.
No, serial or parallel should not matter.
 
Yep...Did all that and still get same GPF. I wonder if processor speed is connected?? I'm running an Athlone 2100(1.7Ghz) what about you? also are you using XP Pro or Home? I have Pro 5.1 (Build 2600).
Haven't tried it on my 2000 box yet, which is P3 650, but will probably do it over next 24 hours.
I'll keep you posted, thanks for all your suggestions.
regards RM

Richard Myers
Four Letter Software Inc.
 
What about writing a small stand alone .EXE file just to open the drawer and see if that works.
There is no doubt in my mind that speed combined with other things causes problems.
In your program try

WAIT WINDOW "" TIMEOUT .2
OPEN THE DRAWER
WAIT WINDOW "" TIMEOUT .2
This has fixed quite a few Windows problems for me in the past.

Ken F
By the way, the "open the drawer" string above should work on all Epson 200 series.
 
I suspect that the answer lies with how W2K and XP handle direct printing to the port (??? means print directly ...).

Ideally, I would get the hardware support paerson (or somebody who installed the 2K / XP computer) to duplicate the settings of the working PC (95/98) in the:
(a) Printer setup (RAW ...)
(b) Control panel. (Disable in hardware profile etc).

This could help.

End

 
? ... display to current device with preceeding line break
?? ... display to current device without preceeding line break
??? ... send output to printer

If ??? still won't work try this equivalent code:

SET PRINTER TO LPT1
SET PRINT ON
SET CONSOLE OFF
? CHR(27)+CHR(112)+"0,48"
SET CONSOLE ON
SET PRINT OFF
SET PRINTER TO && CLEAR PRINTER "SPOOL"

Note that if you wanted to convert "0,48" from a text string to all CHR() commands, use the correct CHR() values:

"0,48"
is same as
CHR(ASC("0"))+CHR(ASC(","))+CHR(ASC("4"))+CHR(ASC("8"))
is same as
CHR(48)+CHR(44)+CHR(52)+CHR(56)

So, really, the text string you originally listed is just fine.
 
Ken,
You said "I have used ??? on XP with NO problem"

What is your secret?
I also cannot use ??? in my FPW26 app on XP without
getting errors. I have about given up opening cash drawers from FPW26 app ...

Tony
 
Tony, don't give up.
Is set compatibility set to Win 95?

First, make sure you have a "Generic Text" printer set as default on the port you are using.
Make the changes in the registry as suggested to remove the 15 second spooling.
In the printers settings Advanced tab put the dot in "Print directly to the printer".
Check that your other settings here are OK.
Get to a MSDOS prompt.
Type "type file.txt > LPT1" (no quotes and file.txt is any existing text file).
Did it print?
If it did, fire up FPW and in the command box try "! type file.txt > LPT1"
Did it print?
If it did try "??? 'ABCDEFG' + chr(13) ".
Did it print?
If it did try your open drawer sequence (don't forget chr(13)).
Did it work?
If the above didn't work, boot into dos 6.2 from a floppy and see if it works with XP of the sceene.
You might track it down this way.

Are you SURE that the drawer trigger works in the first place. The first thing to go on receipt printers is the 24 volt drawer output. And whatever you do, don't try to check it with a light bulb or multi meter. Most trigger circuits must have at least 100 ohm resistance to work on or they blow.
Ken F
 
OK Ken,
I will try your suggestions ..
Thanks,
Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top