469,349 Members | 1,513 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,349 developers. It's quick & easy.

Opening Cash drawer through RS 232 cable

I'm developing a POS with cash drawer integration.But I can't open cash drawer.
I have RS232 cable used to connect cash drawer to PC , dot matrix and cash drawer. This cash drawer has no DLL packaged. Also I tried to open it in DOS
Expand|Select|Wrap|Line Numbers
  1.  echo>com1
but it failed. Another code is
Expand|Select|Wrap|Line Numbers
  1. mode com1:9600,n,8,1 
  2. copy con com1
  3. A
  4. ^z
but it failed too.
Here's my code in VB, but it doesn't worked too..

Expand|Select|Wrap|Line Numbers
  1.  Sub OpenCashDrawer()
  2.  
  3.         ' create an array to hold the command code bytes
  4.         Dim cashDrawerCmd() As Byte = {27, 112, 0, 25, 250}
  5.  
  6.         ' sets up comPort as SerialPort and opens the port
  7.         With My.Computer.Ports.OpenSerialPort("COM7")
  8.  
  9.             Dim blOpen As Boolean = .IsOpen
  10.             Dim blRtsEnabled As Boolean = .RtsEnable
  11.  
  12.             'comPort.RtsEnable = True
  13.             .ReadTimeout = 90000
  14.             .BaudRate = 9600
  15.             .DataBits = 8
  16.             .Parity = System.IO.Ports.Parity.None
  17.             .StopBits = System.IO.Ports.StopBits.One
  18.             .Handshake = System.IO.Ports.Handshake.RequestToSend
  19.  
  20.             ' writes the whole of the byte array containg the open drawer command codes to the port
  21.             .Write(cashDrawerCmd, 0, cashDrawerCmd.Length)
  22.  
  23.         End With
  24.  
  25.     End Sub
  26.  

Dec 5 '09 #1

✓ answered by tlhintoq

Without the documentation for the drawer it's hard to give much advice. The volunteers here have no way of knowing what the correct commands are for your device... or communication speed etc.

I suppose its possible that the drawer is expecting your command string to be CR/LF terminated though. Have you tried it with .WriteLine instead of Write ?

4 8194
tlhintoq
3,525 Expert 2GB
The cash draw connects direct to the PC?
Every cash drawer I've ever used connects to a receipt printer such as an Epson TM-88

When the receipt printer finishes a receipt it sends +12vdc to the drawer to momentarily fire a solinoid and release the drawer.

Does your drawer have what looks like a RJ-45 or RJ-12 on the underside of it? That is where a custom cable to the receipt printer would go.
Dec 7 '09 #2
No, it doesn't have any RJ-45 nor RJ-12 port for these. Just a power outlet and port for the RS232 cable ( 9 pin).
Dec 8 '09 #3
tlhintoq
3,525 Expert 2GB
Without the documentation for the drawer it's hard to give much advice. The volunteers here have no way of knowing what the correct commands are for your device... or communication speed etc.

I suppose its possible that the drawer is expecting your command string to be CR/LF terminated though. Have you tried it with .WriteLine instead of Write ?
Dec 8 '09 #4
Try this dos command...

Create a textfile and save it as .bat file...

ex. open.bat

dir *.bat > COM1

Note: its depends on which port you insert the serial cable if this not work try to change the COM1 to COM2,COM3,COM4,COM5,COM6
Nov 4 '10 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Shakil Shamji | last post: by
4 posts views Thread by Jeff Baynton | last post: by
13 posts views Thread by =?Utf-8?B?Q29ubnVsbA==?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.