About Mscomm Control programming(Serial Port) 
Author Message
 About Mscomm Control programming(Serial Port)

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



Sun, 02 Jan 2005 11:27:50 GMT  
 About Mscomm Control programming(Serial Port)


Wed, 18 Jun 1902 08:00:00 GMT  
 About Mscomm Control programming(Serial Port)
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

Quote:
>-----Original Message-----
>Dear All,
>    I try to write a VB program to listen to the input

data from serail port
Quote:
>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

>.



Sun, 02 Jan 2005 13:15:52 GMT  
 About Mscomm Control programming(Serial Port)
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

Quote:
>-----Original Message-----
>Dear All,
>    I try to write a VB program to listen to the input

data from serail port
Quote:
>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

>.



Sun, 02 Jan 2005 13:15:05 GMT  
 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

> >.



Sun, 09 Jan 2005 11:02:00 GMT  
 About Mscomm Control programming(Serial Port)


Wed, 18 Jun 1902 08:00:00 GMT  
 About Mscomm Control programming(Serial Port)
You must set your lengths to greater than 0 or the OnComm event is not
fired.  As you are set up right now, you must start a loop containing
the .input property to catch data.



Quote:
>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



Mon, 02 May 2005 01:41:07 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. About Mscomm Control programming(Serial Port)

2. Help to program the serial port (null modem) with the win32 api (not MSComm)

3. VB3 Serial Port Control without MSCOMM.VBX

4. Send Voltage via MSCOMM Control and Serial Port

5. Problems with using the control MSComm for serial port communication

6. Serial port controls other than Sax and MSComm

7. Looking for a Serial Port Control to replace MsComm

8. Audio Programming and Serial Port programming advice needed.

9. mscomm - send/receive from serial port

10. ?MSCOMM - Read Signals From Serial Ports

11. Mscomm, serial port question

12. Using serial port without using MSCOMM

 

 
Powered by phpBB® Forum Software