Main
   Home
   About
   DiscussionBoard
Files
   About
   Submit
   Search
Downloads
   Action
   QB64
Links
   Link to us
QB45.org
[ Back to QB45 | FAQ | Search a message | Reply to this message | Back to messages ]

gablea on 10/18/11 - 17:09:21

Hi all

I need some help on something I have been trying to work out for 2 months now.

I am trying to add cash drawer support to some EPoS sofware I am writing but at the moment I can not seen to figure it out.

This is from the user manual for the terminal I am desgining the software for

Cash Drawer
The SureOne POS Terminal uses the industry standard Star interface for the cash drawer. Commands
are actually written to the printer port and the printer electronics control the cash drawer. This interface
can drive a 24 V cash drawer with drive current up to 1 A.
In addition to the industry standard interface that opens a drawer and detects that it is open, the SureOne
POS Terminal also implements the 4680/4690 function of detecting that the cash drawer is attached to the
system when an IBM or compatible cash drawer is used. There is also a simple cash drawer interface for
terminals not equipped with a printer.
Cash drawer open status can be determined through the Enquiry <ENQ> printer command.
There is also logic within the SureOne ASIC chip to drive the cash drawer in the event a printer is not
installed. This circuitry is also used to tell if a cash drawer is physically attached to the system and to
determine which circuit, printer or ASIC, controls the cash drawer interface.
Control register S
Cash drawer setup
INDEX 28H:
Read/write
D7 D6 D5 D4 D3 D2 D1 D0 Function
-------------------------------------------------------------------
x x x x x x x 1 disable C/D driver
x x x x x x x 0 enable C/D driver
x x x x x x 1 x C/D pulse = 100 mS (recommended)
x x x x x x 0 x C/D pulse = 50 mS
x x x x x 0 x x C/D controlled by prt logic
x x x x x 1 x x C/D controlled by ASIC
Control register T
Cash drawer open via ASIC
INDEX 29H:
Write only
D7 D6 D5 D4 D3 D2 D1 D0 Function
-------------------------------------------------------------------
0 0 0 0 0 0 0 1 Pulse C/D circuit
(open drawer)
Control register U
Cash drawer status
INDEX 30H:
Read/write
D7 D6 D5 D4 D3 D2 D1 D0 Function
-------------------------------------------------------------------
x x x x x x 0 x IBM cash drawer connected
x x x x x x 1 x IBM cash drawer not connected
x x x x x 0 x x IBM cash drawer open
x x x x x 1 x x IBM cash drawer closed

can someone help me as I have NO IDea how to get the status bits from the comport (Com3) and to process it to see if the cash drawer is open or closed

Com3 is set outside the software (via MODE COM3:9600,n,8,1) and the QB software can print to the port with no problem.

if someone could help me with just getting the status from the printer and working out the status code (ie open or closed) I can do the rest of the work

Thanks
Andy

gablea on 10/18/11 - 17:44:40

some more information I have found as well that may help you all with the <ENQ> command

Function: Enquiry
Code: <ENQ>
05h
Outline: Causes the control board to transmit a status byte. For the Impact printer, when this code
is received after receiving text data in the STX-ETX mode, the control board transmits the
status and check byte.
The status byte definition is as follows:
Bit Definition
7 Cash drawer status, 0 = open
6 Printer buffer overflow = 1
5 Printer buffer empty = 1
4 Always 0
3 Paper empty = 1
2 Mechanical error = 1
1 Framing error = 1
0 Parity error = 1

Plasma on 10/21/11 - 23:20:38

Need the complete interface doc. Too much is missing from what you have posted.

gablea on 10/25/11 - 12:04:04

I have uploaded the manual for this terminal to my server IBM Manual here

on page 80 the manual talks about the <ENQ> fucntion and on page 95 the manual talks about the cash drawer support fucntion

if someone could help me get this fucntion to work then I will be able to get the others to work as well.

I WELCOME any help as I have never done status reading etc in any of my other programs

Plasma on 10/27/11 - 00:24:31

Ok, there are two methods to get the cash drawer status. You can either use the integrated ASIC or the printer logic. I would use the ASIC method since it seems more reliable.

Here is the ASIC method.

'get current cash drawer config
OUT &H240, &H28
oldconfig% = INP(&H241)

'enable ASIC control of cash drawer
newconfig% = oldconfig% OR 4
OUT &H240, &H28
OUT &H241, newconfig%

'open cash drawer
'OUT &H240, &H29
'OUT &H241, 1

'get cash drawer status
OUT &H240, &H30
status% = INP(&H241)
IF (status% AND 2) = 0 THEN
PRINT "cash drawer connected"
ELSE
PRINT "cash drawer not connected"
END IF
IF (status% AND 4) = 0 THEN
PRINT "cash drawer open"
ELSE
PRINT "cash drawer closed"
END IF

'restore old cash drawer config
'(this will re-enable cash drawer printer control
'if it was enabled previously)
OUT &H240, &H28
OUT &H241, oldconfig%

'de-select control register
OUT &H240, 0


Here is the printer logic method. The cash drawer must be configured for printer logic control. It also requires that the printer be in DTR mode and the data buffer is empty.



'if cash drawer is controlled by the printer
'logic you can also use this code
OPEN "COM3:9600,n,8,1,BIN" FOR RANDOM AS #1
PRINT #1, CHR$(5);
response% = ASC(INPUT$(1, #1))

IF (response% AND 128) = 0 THEN
PRINT "cash drawer open"
ELSE
PRINT "cash drawer closed"
END IF

CLOSE #1


All code is untested since I don't have one of these things...if there are problems let me know.

Reply to this message
Name:
Message:
Please enter this number:
No HTML allowed. You may use BB-code in your posting.
Members
Login
Register
QB45 Members
Member List