
About Mscomm Control programming(Serial Port)
Alex,
I did not notice any setting for the property of handshaking. The
device
may or may not require handshaking. Note the hardware wiring for the
device and note if there are any references to RTS or CTS. It may need
XON/XOFF - check in documentation. Settings of DTREnable, RTSEnable and
Handshaking could be affected. After knowing this, and verifying
that the wiring is right, try again. I do not leave many properties to
chance.
Software handshaking settings:
If comSerial.PortOpen = False Then 'Only open if shut
comSerial.InBufferCount = 0 'Clear buffer
comSerial.RThreshold = 1 'Tell me about every
char
comSerial.CommPort = txtPort.Text 'Set port #
comSerial.Settings = txtSettings.Text 'Grab setting
comSerial.InBufferSize = IBUFSIZE 'set buffer - size pick
your size
comSerial.OutBufferSize = OBUFSIZE
comSerial.Handshaking = comXOnXoff
comSerial.PortOpen = True 'Go - open port
End If
This is in addition to setting on the property pages
DTREnable = True
EOFEnable=False
NullDiscard=False
ParityReplace=?
RTSEnable=False
I have been using the control for HW or SW handshaking (or Both)
using a direct connection or a modem for several years with few
problems.
Used for bar code scanners, RFID units, dedicated equipment, etc.
If only mscomm could handle modems using TAPI .......
Switched to SAX control for that.
Thanks,
rick
Quote:
> You also have to set the property 'RThreshold'. If this is
> 0 then the OnComm-event will not be triggered. Look in the
> helpfiles for more information.
> Gerd
> >-----Original Message-----
> >Dear All,
> > I try to write a VB program to listen to the input
> data from serail port
> >barcode scanner!I use the code as follows:
> > Dim buffer As String
> > Private Sub Form_Load()
> > MSComm1.CommPort = 1
> > MSComm1.Settings = "9600,N,8,1"
> > MSComm1.InputLen = 0
> > MSComm1.PortOpen = True
> > MSComm1.InBufferCount = 0
> > MSComm1.OutBufferCount = 0
> > End Sub
> > Private Sub MSComm1_OnComm()
> > buffer = buffer + MSComm1.Input
> > End Sub
> > I can not get any character from serial port by this
> program, but I can
> >receieve the character data while I use the HyperTerminal
> client!
> > Could you tell me the reason? Any helpful idea would
> be highly
> >appreciated!
> >Best Regards
> >Alex Lu
> >.