Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #31  
Old August 26th, 2005, 10:59 AM
Jaykappy Jaykappy is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Feb 2005
Posts: 743 Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 9 h 45 m 27 sec
Reputation Power: 23
I placed this code under the OnComm Event....I got a return of No....shouldnt they be the same?

CODE:

Public Sub MSComm6.OnComm()

If (MsComm6.CommEvent = comEvREceive) Then
MsgBox "Yes"
Else
MsgBox "No"
End If

End Sub

Reply With Quote
  #32  
Old August 26th, 2005, 11:21 AM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,186 nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 Days 7 h 36 m 24 sec
Reputation Power: 699
Jay,
sorry I just got home from work
In the OnComm do a msgbox mscomm6.commevent
so that we can see what is being passed.

what are you doing to trigger the onComm event?
Sending data to the unit?
__________________
Look! Its a ShemZilla



Reply With Quote
  #33  
Old August 26th, 2005, 11:31 AM
Jaykappy Jaykappy is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Feb 2005
Posts: 743 Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 9 h 45 m 27 sec
Reputation Power: 23
This Returns a message box of "0". So for soem reason the OnComm is not returning the string.....but again if I do it like below in blue I get the whole message?????


Public Sub MSComm6_OnComm()

MsgBox MSComm6.CommEvent

Select Case MSComm6.CommEvent

Case comEvReceive
Buffer = MSComm6.Input
If InStr(Buffer, "$GPGGA") > 0 Then 'See if it has GPGGA in front
TEXTBOX.Text = StrConv(Buffer, vbUnicode)
'MsgBox StrConv(Buffer, vbUnicode)
End If
Case Else
MsgBox "NO DEAL"
End Select




' Dim NMEAString1 As String
' Forms!GPS_RETRIEVE!TEXTBOX.SetFocus

'MSComm6.InBufferCount = 0

' NMEAString1 = MSComm6.Input
' If InStr(NMEAString1, "$GPGGA") > 0 Then
' ' Converting the return so I can read it
' TEXTBOX.Text = NMEAString1
' End If

Reply With Quote
  #34  
Old August 26th, 2005, 11:40 AM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,186 nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 Days 7 h 36 m 24 sec
Reputation Power: 699
mmm,
Quote:
Originally Posted by http://www.yes-tele.com/mscomm.html
Although the OnComm event is generated whenever a communication error or event occurs, the CommEvent property holds the numeric code for that error or event. To determine the actual error or event that caused the OnComm event, you must reference the CommEvent property.

there is no 0?
The code in blue will work yes, but the onComm section is supposed to run each time something happens with the unit, its very strange that it gets a value of 0
try this code, it should get the buffer each time, and then you
can just check if it has the leading text in it. Try it and
see if it works the way you want it.
Code:
Private Sub MSComm6_OnComm()

Buffer = MSComm6.Input
If InStr(Buffer, "$GPGGA") > 0 Then 'See if it has GPGGA in front
	TEXTBOX.Text = StrConv(Buffer, vbUnicode)
End If

End Sub

what do you do to fire the onComm event? Do you send something to the unit?

Reply With Quote
  #35  
Old August 26th, 2005, 11:44 AM
Jaykappy Jaykappy is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Feb 2005
Posts: 743 Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 9 h 45 m 27 sec
Reputation Power: 23
OK....I set the RThreshold to 1, which was set to 0. From my understanding 0 will not trigger the comEvReceive. So now I get these messages....
Im in the Select Statement but something is still wrong....I am not getting the entire string....only bits of it....


2
Input Received (This is the message box just inside the CommEvent)
G
1008
NO DEAL

Reply With Quote
  #36  
Old August 26th, 2005, 11:51 AM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,186 nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 Days 7 h 36 m 24 sec
Reputation Power: 699
ok, sorry, I completly forget about setting the RThreshold

So the comEvReceive is firing then?

can you post the full code you are using now again

Reply With Quote
  #37  
Old August 26th, 2005, 12:03 PM
Jaykappy Jaykappy is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Feb 2005
Posts: 743 Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 9 h 45 m 27 sec
Reputation Power: 23
I try three types of code to return the strings

1. TEXTBOX - I can get this out to a message box....but when I try and get it to the TextBox it gives an error about Setting focus...I tried to add this code: "Form!GPS_RETRIEVE!TEXTBOX.SetFocus" inside the comm event but then I get another error.....

2. MsgBox - if I use MsgBox Buffer I get all the Strings.

3. MsgBox StrConv - If I use MsgBox StrConv(Buffer, vbUnicode) I get a bunch of 1 character hits from somewhere in the string (I Think)



CODE:

Option Compare Database

Private Sub Command8_Click()

'MSComm6.InBufferCount = 0
'Flush the Buffer

If (Not MSComm6.PortOpen) Then

Dim Instring As String
MSComm6.CommPort = 1
MSComm6.Settings = "9600,N,8,1"
MSComm6.InputLen = 0
MSComm6.PortOpen = True
MSComm6.Output = "AT" & vbCr ' Ensure that the modem responds with "OK".
Buffer$ = Buffer$ & MSComm6.Input

MsgBox "SMS Port Open", vbOKOnly, "Port State"
Else
MsgBox "SMS Port Already Open", vbOKOnly, "Port State"
End If

Call MSComm6_OnComm

' Form!GPS_RETRIEVE!TEXTBOX.SetFocus

End Sub

'==========================================

Public Sub MSComm6_OnComm()

' MsgBox MSComm6.CommEvent

Select Case MSComm6.CommEvent

Case comEvReceive

MsgBox "Input Received"

Buffer = MSComm6.Input
If InStr(Buffer, "$GPGGA") > 0 Then 'See if it has GPGGA in front

'TEXTBOX.Text = StrConv(Buffer, vbUnicode)
MsgBox StrConv(Buffer, vbUnicode)
'MsgBox Buffer


End If
Case Else
MsgBox "NO DEAL"
End Select

End Sub

Reply With Quote
  #38  
Old August 26th, 2005, 12:07 PM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,186 nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 Days 7 h 36 m 24 sec
Reputation Power: 699
Jay, the onComm is not supposed to be called in the code, its supposed to fire each time something happens on the unit itself.

example: I have a sms modem attached to a comm port, when I sms to the number on the modem, the onComm fires, I check if its evReceived, then I check the first 4 digits of the buffer, if its CMGS, then I know there is a sms and act accordingy.

How can you send something to the unit without your pc?

Reply With Quote
  #39  
Old August 26th, 2005, 12:31 PM
Jaykappy Jaykappy is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Feb 2005
Posts: 743 Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 9 h 45 m 27 sec
Reputation Power: 23
Sorry About that....I commented that Call out.....so dont worry about that....

When I use the MsgBox Buffer I am gettgng a message box with "$GPGGA," and thats it....It is then followed by about 3-4 more msgbox's with all the strings....then the single $GPGGA, string pops back up...and I enter a loop.....The thing is I am only getting $GPGGA, and missing the rest of the string....So do I need to write code to continue reading until it reaches another $ ?

If I use the "MsgBox StrConv" then I only get one character and a repeat loop of message boxes each returning a different character....

Reply With Quote
  #40  
Old August 26th, 2005, 12:38 PM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,186 nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1Folding Points: 112786 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 Days 7 h 36 m 24 sec
Reputation Power: 699
thats really strange, try setting the inputLen = 0 in the case statement:
for each event, it should get the whole input using .Input?
Code:
Public Sub MSComm6_OnComm()
Select Case MSComm6.CommEvent
	Case comEvReceive
		MSComm6.InputLen = 0
		Buffer = MSComm6.Input
			If InStr(Buffer, "$GPGGA") > 0 Then 'See if it has GPGGA in front
				msgbox Buffer
			End If
	Case Else
		MsgBox "NO DEAL"
End Select
End Sub

hope this helps

Reply With Quote
  #41  
Old August 26th, 2005, 01:43 PM
Jaykappy Jaykappy is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Feb 2005
Posts: 743 Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 9 h 45 m 27 sec
Reputation Power: 23
I dont know whats going on....I click the OnClick and I get a message box with $GPGGA, but am missing the rest of the string....then I get about 3-4 more message boxes with all the strings in them (Think from teh entier buffer). Then it starts all over again.....

Any thoughts?

Reply With Quote
  #42  
Old August 26th, 2005, 01:45 PM
Jaykappy Jaykappy is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Feb 2005
Posts: 743 Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 9 h 45 m 27 sec
Reputation Power: 23
I did it again and I get the Partial $GPGGA adn tehn 3-4 message boxes with all teh strings and then there was a loop with nothing but message boxes with the Partial $GPGGA string. Somethign weird is happening....

I thought that having the end If I would prevent the Loop....

Reply With Quote
  #43  
Old August 26th, 2005, 01:48 PM
Jaykappy Jaykappy is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Feb 2005
Posts: 743 Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)Jaykappy User rank is Sergeant (500 - 2000 Reputation Level)