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 with the
same settings!
    Could you tell me the reason? Any helpful idea would be highly
appreciated!

Best Regards
Alex Lu



Sun, 02 Jan 2005 11:29:23 GMT  
 About Mscomm Control programming(Serial Port)
RThreshold needs to be set = number of characters you want to receive
between OnComm events.. iow, if you want an event for each character,
RThreshold must be set = 1.. There's a sample in help. And, here's
another...

INFO: Receiving Data Using the MSComm Control's OnComm Event (Q194922)
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q194922

--
Ken Halter - MS-MVP-VB - Please keep it in the groups..
http://www.vbsight.com - http://www.vbsight.com/MultiColumn.htm

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 with the same settings!
>     Could you tell me the reason? Any helpful idea would be highly
> appreciated!

> Best Regards
> Alex Lu



Sun, 02 Jan 2005 23:37:05 GMT  
 
 [ 2 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