Ii. cash drawer testing, B. opening the cash drawer using basic, Start = timer: while timer < start + .2: wend – APG Cash Drawer Model 212A Smart SerialPRO User Manual

Page 2: Code%=inp\(&h3fe\): rem – assuming com1 used, If \(code% and 16\) = 16 then print "–cts opti, If \(code% and 16\) = 0 then print "–cts optio, If \(code% and 64\) = 64 then print "–ri optio, If \(code% and 64\) = 0 then print "–ri option, C. opening the cash drawer using visual basic, Mscomm1.commport = 1‘ define com1 as port to be o

Advertising
background image

II. Cash Drawer Testing

The following examples will illustrate how to open the drawer with the original factory switch settings. If the operating
system is Windows™ environment, use the DOS window for the command entry. COM1 is used throughout this
example. Replace COM1 with COM2, etc., if appropriate. Type the bold letters into the computer.

A. Opening the Cash Drawer using DOS

1. Verify the switches on the cash drawer are set to the original factory settings. Refer to Figure 6 in Section III.B for

these settings.

2. Set the Mode command, which will define the communication parameters of the serial port.

C:\>MODE COM1:9600,O,7,1 ("Enter" key)

3. The following command will transmit all of the files in the directory out to the serial port. If the cash drawer is

connected properly, the yellow indicating light inside the cash drawer will flash as characters are received.

C:\>DIR >COM1 ("Enter" key)

4. The following command will transmit two left bracket characters to open the cash drawer.

C:\>ECHO [[>COM1 ("Enter" key)

At this point, the cash drawer should open with the original factory dip switch setting.

B. Opening the Cash Drawer using BASIC

To open drawer in Basic:

OPEN "COM1:9600,O,7,1,CS,DS,CD" FOR RANDOM AS #1
PRINT #1, "[[": REM – TWO LEFT BRACKET CHARACTERS

There are two options for reading drawer status in Basic:

START = TIMER: WHILE TIMER < START + .2: WEND
REM – 200 mSEC ALLOWS DRAWER TO OPEN BEFORE CHECKING STATUS
CODE%=INP(&H3FE): REM – ASSUMING COM1 USED

1) Reading CTS drawer status in Basic (See Figure 4):

IF (CODE% AND 16) = 16 THEN PRINT "–CTS OPTION - DRAWER CLOSED"
IF (CODE% AND 16) = 0 THEN PRINT "–CTS OPTION - DRAWER IS OPEN"

2) Reading RI drawer status in Basic (See Figure 5):

IF (CODE% AND 64) = 64 THEN PRINT "–RI OPTION - DRAWER CLOSED"
IF (CODE% AND 64) = 0 THEN PRINT "–RI OPTION - DRAWER IS OPEN"

C. Opening the Cash Drawer using Visual Basic

Install the Microsoft COM control into the Components bar. Add MSCOMM to the form and the following into the code
as applicable.

MSComm1.CommPort = 1

‘ Define COM1 as port to be opened

MSComm1.PortOpen =

True

‘ Open the serial port

MSComm1.RTSEnable =

True

‘ Turn RTS high

MSComm1.DTREnable =

True

‘ Turn DTR high

...

MSComm1.Output = “[[“

‘ Transmit characters to open cash drawer

...

If

MSComm1.CTSHolding

Then

‘ Cash drawer is closed if CTS status enabled

...

Note that RI for cash drawer status is not adequately supported in Visual Basic. OPOS drivers (which support both
methods for drawer status, RI & CTS) are available for developers from the APG website:

http://www.apgcd.com

.

Advertising