Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to read from an electronic scale (POS app)

505 views
Skip to first unread message

Cesar F. Manzano T.

unread,
Mar 1, 2000, 3:00:00 AM3/1/00
to
I am developing a Point of Sale application and I bought a NCI 6720-15
(Weigh-Tronix) electronic scale; it has a serial port an cable and all that
I am supposed to do is send "W<CR>" and read "<LF>(weight in numbers)<CR>".

How do I do that?. Do I need a .dll for RS-232 interface? Are the old
FOPEN(), FWRITE() and FREAD() still working for Win98 and VFP6?

Thanks in advance

Rick Bean

unread,
Mar 2, 2000, 3:00:00 AM3/2/00
to
Cesar,
Windows (especially NT), doesn't like anyone directly accessing the com
ports, instead use the MS Communications Control (Mscomm32.ocx) - assuming
you are using VFP. See
http://support.microsoft.com/support/kb/articles/Q154/7/41.asp for some
sample code.

Rick

"Cesar F. Manzano T." <cman...@avantel.net> wrote in message
news:#ehhOMBh$GA....@cppssbbsa02.microsoft.com...

Garrett Fitzgerald

unread,
Mar 2, 2000, 3:00:00 AM3/2/00
to
In article <#ehhOMBh$GA....@cppssbbsa02.microsoft.com>,
cman...@avantel.net (Cesar F. Manzano T.) quoth...

> I am developing a Point of Sale application and I bought a NCI 6720-15
> (Weigh-Tronix) electronic scale; it has a serial port an cable and all that
> I am supposed to do is send "W<CR>" and read "<LF>(weight in numbers)<CR>".

I would suggest looking into a OLE for POS (OPOS) driver for this --
would make it easier to program, if they have one.
--
Garrett Fitzgerald
#INCLUDE "\Program Files\Microsoft Visual Studio\VFP98\stddsclm.h"
(Anyone who thinks I do anything vaguely resembling speaking for Microsoft
is sorely deluded...)

Cesar F. Manzano T.

unread,
Mar 4, 2000, 3:00:00 AM3/4/00
to
Thank You all, I made the scale work and also a PSC VS1200 countertop
scanner; both connected to serial ports.

How to deal with serial ports and MSCOMM32.OCX ? read on

For the scale ...
************
(the trick is to wait)

*** cmdWeight.Click()
SET DECIMALS TO 3 && ** If not, it rounds the weight to 2
decimals
LOCAL el_peso, eran, ns

eran = SET( 'DECIMALS', 1)

WITH THISFORM.oleBascula && *** the name of the object MSCOMM32

ns = SECONDS()
.portopen = .T.
.inputlen = 20

DO WHILE SECONDS()- nS < 1 && ** A loop to read the COM port
.output = "W" + CHR(13) && ** An orden to the scale
&& (it's part
of the NCI protocol)
FOR x = 1 TO 100000 && ** Just waiting ...
ENDFOR

el_peso = .input && ** Here is the weight
measured

el_peso = RIGHT( el_peso, LEN( el_peso) - 1)
el_peso = VAL( LEFT( el_peso, 7))

IF el_peso > 0
THISFORM.txtPeso.Value = el_peso
EXIT
ENDIF

ENDDO
.portopen= .T.
ENDWITH

SET DECIMALS TO (eran)

For the scanner ...
************
(the trick is to use the OnComm event to let the data flow in alone)

*** In the Form Init method...
THISFORM.oleScanner.portopen = .T.
*** In the cmdExit.Click() ( exit button)
THISFORM.oleScanner.portopen = .F.

*** In the ONCOMM Event of the OLE object (THISFORM.oleScanner)
IF This.CommEvent = 2 AND This.InBufferCount > 0 && *** There is something
in the scanner !!

WITH THISFORM.txtClave
la_clave = THIS.input
la_clave = RIGHT( la_clave, LEN( la_clave) - 1) && *** I clean up an
"A" that I get (??)

.Value = la_clave
.Valid()
ENDWITH

ENDIF

Of course I validate that we are entering codes and the cashier does not use
buttons but F-( ON KEY LABEL F10
_ACTIVEFORM.cmdIniciar.Click())

0 new messages