Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP7 MSCOMM Object
Message
De
21/11/2003 09:19:26
Terry Davis
Enhanced systems consulting
Tennessie, États-Unis
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Titre:
VFP7 MSCOMM Object
Divers
Thread ID:
00852283
Message ID:
00852283
Vues:
48
Need some help! How can I determine if a command is really being sent via an mscomm object to an external device, without having the device connected. I don't know if the problem is the device or the 'sending' of the command.
I am using vfp7, windows xp with a 2gig processor. I have a form with 2 text boxes and 2 mscomm objects, com1 and com2. first textbox receives the feed via com1 from a fixed head scanner. second textbox receives feed via com2 connected to a conveyor system with an inline scale.

The way the process is designed to work is:
start form, open com1 set settings, open com2 set settings, start conveyor, read barcode via com1, if good read, receive weight via com2, update record. If bad read, stop conveyor, manually enter barcode or via keyboard scanner, if good read, start conveyor, receive scale weight, update record. Repeat process.

The receiving of data from both devices works fine. scanner reads barcode, lookup performed, scale weighs object sends weight to form, weight recorded for corresponding barcode. repeat process.

The starting and stopping of the conveyor is the problem. I question whether the sending is actually occuring or if the equipment is receiving the command and not responding.

The problem occurs when the scanner incurs a bad read. When this happens the code sends a "stop" command to the conveyor via com2. the command is thisform.olecom2.output = chr(27)+chr(13). It does NOT seem to be being sent immediately OR not being received by the conveyor device immediately. I can send the stop command 4 times in a row and the conveyor responds.
To start the coveyor, same thing, ..output = chr(14)+chr(13), 4 times.
HOWEVER
when I send the command multiple times the scale weight feed via com2 is not received, as if the buffer has something in it at the time when the scale is trying to send the weight.

I have tried different handshaking settings, baud rates, rthreshold, sthreshold settings no luck.
COM2 settings, 9600,e,8,1, rthreshold = 1, sthreshold = 0

here is the STOP code
********************
IF ThisForm.oleComm2.PortOpen = .F.
ThisForm.OpenComm2()
ThisForm.oleComm2.InBufferCount = 0
ELSE
ThisForm.oleComm2.InBufferCount = 0
ENDIF

ThisForm.oleComm2.outBufferCount = 0

*stop coveyor
ThisForm.oleComm2.output = CHR(27) + CHR(13) &&X

*clear buffers
ThisForm.oleComm2.InBufferCount = 0
ThisForm.oleComm2.outBufferCount = 0

ThisForm.llconveyon = .F.
***********************

Start code
***********************
IF ThisForm.oleComm2.PortOpen = .F.
ThisForm.OpenComm2()
ThisForm.oleComm2.InBufferCount = 0
ELSE
ThisForm.oleComm2.InBufferCount = 0
ENDIF

ThisForm.oleComm2.outBufferCount = 0

ThisForm.oleComm2.output = CHR(14) + CHR(13)

ThisForm.oleComm2.InBufferCount = 0
ThisForm.oleComm2.outBufferCount = 0

ThisForm.llconveyon = .T.




Any help you can provide would be greatly appreciated!
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform