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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening a cash drawer 1

Status
Not open for further replies.

DeltaTech

Programmer
Apr 16, 2003
92
0
0
MY
Hi
Has anyone developed a POS solution that requires trigerring the opening of a cash drawer programatically?
If so, would very much appreciate if you could tell me how I can communicate with a serial port cash drawer.
Thanks!
[bigcheeks]
 
Hi,

I'll be honest, I'm not completely sure how to open the drawer myself.

Something along the lines of:

Code:
Private Sub Form_Load()
   ' Set and open port
   MSComm1.CommPort = 1
   MSComm1.Settings = "9600,n,8,1"
   MSComm1.PortOpen = True
End Sub

Private Sub CommandOpenTheDrawer_Click()
    'Send some ascii characters down the line
    'Assuming this is the required command to open the drawer
    MSComm1.Output = "OPEN THE CASH DRAWER"
End Sub

I googled to find this and i found it at:


Not sure if this is any help to you but it might be worth a try??

Harleyquinn
 
Hey Harleyquinn
Thanks mate!
Did try searching the web and came across the same post, but could not see the answer because I am not subscribed. (Hooray for tek-tips!) A subsequent search for cash drawer at the same site turned up several other posts as well.
Will certainly give it a try and let you know.
Thanks again.
[bigcheeks]
 
You will need to contact the manufacture and find out what
codes open the drawer, not all of them use the same codes.

never actually done it myself but the people I work with do it all the time and it changes by manufacture.
 
I can't resist the obvious.. What about a crowbar?

Sorry, really I am, just couldn't resist.
 
I wrote a POS system but could not figure our how to use the "OPOS" interface, on the site pointed to by TallOne.

So I set up an "Option" form where the user (in consultation with the technical book that comes with the cash drawer) can select the Port, Baud Rate, Parity, Data Bits, Stop Bits, Hex codes for openning the drawer and the Multiplier (which is the number of time the "open code" needs to be sent to the drawer). This form also contained a "Test" button for the operator to test that the parameters were effective.

I then stored this info in the registry for that site.

You could even adapt this approach for multiple drawers of (even) varying brands/models.

I used the MsComm control to talk to the drawer.

I found one of the best ways to learn was to contact one of the larger drawer manufacturers and get their manual. Even though other drawers may vary in content they all have the same data headers.

Cheers.

"Life is full of learning, and then there is wisdom"
 
Many thanks everyone, especially pkailas. The crowbar worked a charm and it opened everytime!
Anyways, to bring this to a close, allow me to summarise for the benefit of anyone who might need to do this in the future.
Settings for cash drawers vary from manufacturer to manufacturer, so we need to enable the setting of the following parameters:
1. The type of cash drawer - this could be serial port, parallel port or even connected indirectly through a printer or display pole.
2. The Port - this depends on the type of cash drawer above.
3. The Baud Rate, Parity, Data Bits, Stop Bits - these should be, I believe, fairly standard settings and should not vary from manufacturer to manufacturer. Still, it might pay to take it anyway.
4. The Hex codes for opening the drawer and the Multiplier - these may vary between manufacturers. Generic settings may be "Ctrl-g" for Hex codes and 1 for Multiplier (which as koala15 said is the number of times you need to send the Hex code to the drawer before it opens)

To communicate with a cash drawer, you need to use the MsComm Control, and thanks to Harleyquinn, the code for opening the drawer looks like this:


MSComm1.CommPort = 1
MSComm1.Settings = "9600,n,8,1"
MSComm1.PortOpen = True
MSComm1.Output = "^g"

That's about it, I think. Am waiting for a demo cash drawer to try it out, and will let you guys know how it goes.

Anyway, if that fails, we can always use the crowbar like pkailas suggested. :)

[bigcheeks]
 
If you liked that solution, wait till you see my solution for anti-virus.

I'm going to call it "Microsoft Scissors". I'm going to package a wire cutter and instructions on how to safely sever the power cord leading to the PC.
 
Hi
It works!
To add to my post of Dec 7, the port settings for cash drawers vary from manufacturer to manufacturer. The one that I obtained for testing works with the following code:

Code:
    with MSComm1
       .CommPort = 1
       .Settings = "300,n,8,1"
       .PortOpen = True
       .Output = Chr$(7)
       .PortOpen = False
    end with

So it would pay to persist the settings in a database rather than hard coding it.

[bigcheeks]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top