|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#31
|
|||
|
|||
|
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 |
|
#32
|
||||
|
||||
|
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 ![]() ![]()
|
|
#33
|
|||
|
|||
|
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 |
|
#34
|
||||
|
||||
|
mmm,
Quote:
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? |
|
#35
|
|||
|
|||
|
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 |
|
#36
|
||||
|
||||
|
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 ![]() |
|
#37
|
|||
|
|||
|
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 |
|
#38
|
||||
|
||||
|
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? |
|
#39
|
|||
|
|||
|
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.... |
|
#40
|
||||
|
||||
|
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 |
|
#41
|
|||
|
|||
|
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? |
|
#42
|
|||
|
|||
|
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.... |
|
#43
|
|||
|