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!

Sent Data to Com1 FoxPro 2.6a Windows

Status
Not open for further replies.

snowman

MIS
Sep 24, 1998
1
0
0
US
Please if someone Knows how I can open com1 and sent any kind of data to open a cash drawer. The drawer accept any type of data and performs its functions. Thank in advanced.

Edwin
 
try this:

You must print before running this procedure (if your drawer is attached to a serial printer)


procedure cash

port="COM1"

handle=FOPEN(port,11)
=FWRITE(handle,CHR(27)+"@")
=FCLOSE(handle)

handle=FOPEN(port,11)
=FWRITE(handle,CHR(27)+"@")
=FWRITE(handle,CHR(27)+CHR(112)+CHR(0)+CHR(100)+CHR(250))

=FCLOSE(handle)

 
Gigatech,
I hope you know that this will likely NOT work on NT / 2000 / XP, and depending on configuration settings and other applications, may not work under 95 / 98 / SE / ME.

Writing directly to COM ports directly with low-level IO only works consistent when running FPD on DOS (not in Windows). Even the FPW help file states "Ports cannot be opened with low-level file functions in FoxPro for Windows and FoxPro for Macintosh."

Rick
 
I work with POS application under FPW26 on Windows 95/98/ME and I open cash drawers, write in Customer displays and print "in line" without problems.

You are right, it does not work on NT/2000/XP
 
I set the com port up to be a printer port and then send something to it. Like this...
************************
! mode com1 96,n,8,1 * Run once
! mode lpt3 = com1 *
************************
then.....
***************************
save sys(6) to MPRINTERWAS* To open the drawer
set printer to lpt3 *
??? "X" *
set printer to MPRINTERWAS*
***************************
You could probably just set the com port up with...
! mode com1 96,n,8,1 && run once
set printer to com1
??? "X"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top