Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Communications with serial ports
Message
De
08/04/1998 04:35:14
Cristian Tenea
Aquila Part Prod Com
Ploiesti, Roumanie
 
 
À
07/04/1998 11:28:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00090173
Message ID:
00090362
Vues:
27
Hi,

I used MSComm control to comunicate with an PLC with or without modem, to control proces in termal plant.
Help files for MSComm control are sufficent for use it.

Example: supose we have a form with 'comm'=MSComm object in it.

Initialization:
thisform.comm.settings="9600,N,8,1"
thisform.comm.commport=2 & COM2 with 9600baud ....
thisform.comm.portopen=.T. & try to open port
if !(thisform.comm.portopen)
=messagebox('Port not opened!',0,'Error')
endif
.... now comunicate with something on port with
thisform.comm.output="bla bla bla..."
lreturnedvalue=thisform.comm.input

More useful settings:

comm.inputlen=0 & read entire buffer when you use comm.input
comm.inbuffercount & number of chr received in buffer
comm.outbuffercount & -\\- in output buffer
comm.rthreshold & number of chr received for fire event comm.oncomm()
comm.commevent & numeric code of event who fired comm.oncomm()

For more help right-click on MSComm and choose Help..
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform