Advertisement

09.18.2008 at 04:57PM PDT, ID: 23744453
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.6

Not receiving data on Comm port

Asked by djcminuz in Microsoft Excel Spreadsheet Software, VB Controls

Tags:

No data is being inputed on the worksheet. I verified that the data is coming in serially using hyperterm. How do I verify the data is coming in on MSCOMM and excel. I attached the code I have been helped with also to see if I am making errors as well. ThanksStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
Option Explicit
 
Private Sub closePortBTN_Click()
mscomm1.PortOpen = False
End Sub
 
Private Sub openPortBTN_Click()
'Declarations
'Dim selPort As Integer
 
'initializations
'selPort = portCMBX.Text
 
'Setup comm port
    'If mscomm1.PortOpen Then mscomm1.PortOpen = False
    mscomm1.CommPort = 3 'Port that is being used for the connection
    mscomm1.Settings = "9600, n, 8, 1"
    mscomm1.InputLen = 0
 
    mscomm1.PortOpen = True
        If Not mscomm1.PortOpen Then GoTo pError
 
pError:
    Select Case Err.Number
 
    Case 8005:
        listBX.AddItem ("COM" & portCMBX.Value & " Unavailable")
        listBX1.Text = "COM " & portCMBX.Value & " Unavailable" & vbCrLf
        Err.Clear
        Resume Next
        
    Case 0:
        MSComm1_OnComm
        'On Error Resume Next
        
    Case Else:
        listBX.AddItem ("Error " & Err.Number & " : " & Err.Description)
        listBX1.Text = "Error " & Err.Number & " : " & Err.Description & vbCrLf
        Err.Clear
        Resume Next
    End Select
Exit Sub
 
End Sub
 
Private Sub UserForm_Initialize()
loadPorts
End Sub
 
Public Sub loadPorts()
'Variable declarations
Dim port As Integer
 
'Loop through system to find available com ports
For port = 1 To 16
    mscomm1.CommPort = port
    mscomm1.Settings = "9600,N,8,1"
    mscomm1.InputLen = 0
    On Error Resume Next 'GoTo portError 'Send to portError event it occurs
    mscomm1.PortOpen = True
    
    Select Case Err.Number
    Case 8005:
        listBX.AddItem ("COM" & port & " Unavailable")
        listBX1.Text = "COM" & port & " Unavailable" & " "
        Err.Clear
        'Resume Next
    Case 8002:
        listBX.AddItem ("COM" & port & " Does not exist")
        listBX1.Text = "COM" & port & " Does not exist" & " "
        Err.Clear
        'Resume Next
    Case 0:
        If mscomm1.PortOpen = True Then mscomm1.PortOpen = False
        portCMBX.AddItem ("COM " & port)
        'Resume Next
    Case 20:
        Err.Clear
    Case Else:
        listBX.AddItem ("Error " & Err.Number & " : " & Err.Description)
        listBX1.Text = "Error " & Err.Number & " : " & Err.Description & " "
        Err.Clear
        'Resume Next
    End Select
    
Next port
End Sub
 
Private Sub MSComm1_OnComm()
'Declarations
Dim dataBuff, p, Message As String
 
'MSComm events
Select Case mscomm1.CommEvent
 
' Errors
Case comEventBreak   ' A Break was received.
Case comEventCDTO    ' CD (RLSD) Timeout.
Case comEventCTSTO   ' CTS Timeout.
Case comEventDSRTO   ' DSR Timeout.
Case comEventFrame   ' Framing Error.
Case comEventOverrun ' Data Lost.
Case comEventRxOver  ' Receive buffer overflow.
Case comEventRxParity   ' Parity Error.
Case comEventTxFull  ' Transmit buffer full.
Case comEventDCB     ' Unexpected error retrieving DCB]
Case comEvReceive
    'Loop to gather gps data
    dataBuff = mscomm1.Input 'dataBuff & mscomm1.Input 'append Input data to our buffer
    p = InStr(dataBuff, vbCrLf)
    If p > 0 Then
        Message = Left$(dataBuff, p - 1) 'extract first full line
        ParseMessage (Message)
        dataBuff = Mid$(dataBuff, p + 2) 'remove the used data
    End If
 
    'ActiveSheet.Cells = p
 
End Select
 
End Sub
 
Sub ParseMessage(strMessage As String)
    Dim strData() As String
    Dim r As Integer
    Dim c As Integer
    
    strData = Split(strMessage, ",")
    r = 1
    Do Until ActiveSheet.Cells(r, 1) = ""
        r = r + 1
    Loop
    For c = 1 To UBound(strData) + 1
        ActiveSheet.Cells(r, c) = strData(c - 1)
    Next c
End Sub
[+][-]09.19.2008 at 02:27AM PDT, ID: 22519124

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.19.2008 at 02:33AM PDT, ID: 22519162

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.19.2008 at 02:34AM PDT, ID: 22519166

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.19.2008 at 03:49AM PDT, ID: 22519661

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.19.2008 at 06:20AM PDT, ID: 22520767

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Excel Spreadsheet Software, VB Controls
Tags: VBA, MSCOMM, Excel
Sign Up Now!
Solution Provided By: djcminuz
Participating Experts: 2
Solution Grade: A
 
 
[+][-]09.20.2008 at 01:34PM PDT, ID: 22531487

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.21.2008 at 02:18PM PDT, ID: 22536097

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.21.2008 at 04:10PM PDT, ID: 22536391

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628