Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to speed up communications with mscomm
Message
De
16/09/2003 10:16:17
 
 
À
15/09/2003 17:01:39
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Divers
Thread ID:
00829125
Message ID:
00829395
Vues:
22
38400 is the maximum rate that the cnc machine will accept. I am using xon/xoff which is no slower than none. rts/cts really makes things crawl, so i dont use that.

send code:
thisform.zclosecomm()
If Thisform.zopencomm(Alltrim(Thisform.txtmy2.getvalue()),Thisform.spnmy1.getvalue(),Thisform.ogmy1.getvalue()-1)
	thisform.setall('mousepointer',11)
	Local lnBitLength, lnLen, lcOutput, lcSend, lnPos, lnSeconds, lnPass
	lnPass=0
	lnSeconds=SECONDS()
	lcOutput=Alltrim(Thisform.edtmy1.getvalue())
	lnLen=Len(lcOutput)
	lnBitLength=Thisform.spnmy2.getvalue()
	If Thisform.chkmy2.getvalue()
		Local loProgress
		loProgress = Thisform.omessage.ProgressBar('Transferring Code File...')
		loProgress.SetProgressRange(0, lnLen)
		For lnPos=1 To lnLen Step (lnBitLength)
			lcSend=Substr(lcOutput,lnPos,lnBitLength)
			IF thisform.chkmy3.getvalue() &&remove cr
				lcSend=STRTRAN(lcSend,CHR(13),'')
			endif
			IF !EMPTY(lcSend)
				Thisform.mscomm.Output=(lcSend)
			ENDIF
			Thisform.EDTMY1.SelStart = lnPos
			lnPass=lnPass+1
			loProgress.UpdateProgress(lnPass*lnBitLength)
*			=Inkey(.005)
		Endfor
		loProgress.CloseProgress()
	Else
		IF thisform.chkmy3.getvalue() &&remove cr
			lcOutput=STRTRAN(lcOutput,CHR(13),'')
		endif
		Thisform.mscomm.Output=(lcOutput)
	Endif
	lnseconds=SECONDS()-lnSeconds
	thisform.ostatemanager.openform('frmmymessage',ALLTRIM(STR(lnLen))+' bits sent in '+ALLTRIM(STR(lnseconds))+' seconds',30)
	thisform.setall('mousepointer',0)

Endif
zopencomm:
**	open the mscomm control with the correct settings
LPARAMETERS cSettings, nPort, nHandShake

DO CASE
	CASE EMPTY(m.cSettings)
		THISFORM.omessage.warning(PROPER('no baud settings passed, operation aborted'))
		RETURN .F.
	CASE m.nPort<=0
		THISFORM.omessage.warning(PROPER('no port number passed, operation aborted'))
		RETURN .F.
	CASE THISFORM.mscomm.portOpen=.T.
		THISFORM.omessage.warning(PROPER('comm port is already open, operation aborted'))
		RETURN .F.
	OTHERWISE
		THISFORM.mscomm.commport=m.nPort
		THISFORM.mscomm.Settings=m.cSettings
		THISFORM.mscomm.dtrenable=.T.
		THISFORM.mscomm.rtsenable=.T.
		IF !EMPTY(m.nHandShake) && if optional parameter is passed change it
			thisform.mscomm.handshaking=m.nHandShake
		endif

		THISFORM.mscomm.portOpen=.T.
		RETURN .T.
ENDCASE
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform