Results 1 to 2 of 2

Thread: Program working abnormally for large number of handsets

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2006
    Posts
    30

    Program working abnormally for large number of handsets

    I'm using MSComm control for developing a Personal Response System.

    Following are the settings for MSComm control that I'm using:

    Code:
    MSComm1.CommPort = PortNo     
    MSComm1.Settings = "115200,N,8,1"
    MSComm1.InputLen = 100
    MSComm1.RThreshold = 1
    MSComm1.SThreshold = 1
    MSComm1.PortOpen = True
    Following is the onComm event of the MSComm control:

    Code:
    Private Sub MSComm1_OnComm()
        Dim i As Integer, j As Integer, k As Integer
        Dim remoteno  As Integer, keypressed As String
        Dim a() As Byte
        Dim buffer() As Byte
        Dim BufferLength As Integer
        Dim strbuffer As String
        Dim diff As Double
        
        Select Case MSComm1.CommEvent   
            'errors
            Case comEventBreak
            Case comEventCDTO
            Case comEventCTSTO
            Case comEventDSRTO
            Case comEventFrame
            Case comEventOverrun
            Case comEventRxOver
            Case comEventRxParity
            Case comEventTxFull
            Case comEventDCB
        
            'events
            Case comEvCD
            Case comEvCTS
            Case comEvDSR
            Case comEvRing
            Case comEvReceive
                strbuffer = ""
                BufferLength = MSComm1.InBufferCount
                If BufferLength > 0 Then
                    buffer = MSComm1.Input
                    k = 0
                    i = UBound(buffer)
                    For j = 0 To i                    
                        If j = 1 Then
                            remoteno = buffer(j)
                        ElseIf j = 5 Then
                            keypressed = buffer(j)
                        End If
                        strbuffer = strbuffer & buffer(j) & ":"
                    Next j
                End If
            'MsgForm strbuffer
            Case comEvSend
            Case comEvEOF
            Case Else
        End Select
       
        If BufferLength > 0 Then
            'Process user's response....
        End If
    End Sub
    When the user gives response from his handset then each response is processed in the onComm event.

    It's working fine for small no. of handsets but the problem arises when a large no. of handets are used.

    Any help would be grateful.

    Regards,
    Raman

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Program working abnormally for large number of handsets

    What's the hardware configuration? What's a "handset"? What does it send? Do you have one MSComm control for each handset?

    BTW, all the Case lines that have no code associated with them can be deleted to make the code easier to read. IOW
    Code:
        Select Case MSComm1.CommEvent   
            Case comEvReceive
                strbuffer = ""
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width