|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Accessing Com Port
I have a few questions which I hope you all can help point me in the right direction.
A little background is in order. What I am trying to accomplish is Read the NMEA string passed to the Com Port 1 of a laptop from a Trimble GPS Unit. Once I have the string I need to parse it ang place the Lat Long in a couple fields in my Access Database. First off I have to capture the string from the Com Port. Does anyone have any suggestions of where I can start to learn the code needed to read the Com Port 1 to retrieve the NMEA String pushed from the GPS Unit? How can I do this from within an Access Database? If I can get the string returned to a variable that would be great. From what I heard other people were writing this to a file? Any help would be appreciated. Thanks, Jay |
|
#2
|
||||
|
||||
|
Hi Jay,
here is a short extract form an app I wrote that gets the input from a siemens cellphone Modem: Code:
Private Sub MSComm1_OnComm() Select Case MSComm1.CommEvent Case comEvReceive buffer = MSComm1.Input MsgBox StrConv(buffer, vbUnicode) Case Else MsgBox "Unknown error or event" End Select End Sub I hope this helps in some way, I don't have much experience with this either, but this works for me, hope it does for you ![]()
__________________
Look! Its a ShemZilla ![]() ![]()
|
|
#3
|
|||
|
|||
|
Accessing Com Port
That helps a little....dont really understand the syntax needed to hit the com port. I have been looking for other example and have nto found any. I think if I can get the msgBox to return the string on will be well on my way.
Thanks for your help and IO look forward to any other helpfull suggestions or tid bits of code........ |
|
#4
|
||||
|
||||
|
Hi Jay,
the MSComm1_OnComm() is the event that fires when there is something happening on the Unit and it then I use the case statement to check if its a ComEvReceive(Comm Event Received) then I use a buffer (normal string variable) to get the input from the Commport using MSComm1.Input Then I convert that buffer to vbUnicode, so that I can read it. You you will have something like "AT+CGMS=1" in that variable(in my case I used AT Commands to talk to the modem) you just need to know what interupt is sent from the unit for each type of command, and then use that to direct the program further. do you have a list of commands/interupts of that unit? hope this helps |
|
#5
|
|||
|
|||
|
Accessing Com Port
First off let me thank you for you help. This is the first time I have tried something like this. That is returning something from an outside source.
The GPS Unit sends NMEA Strings such as: $GPRMC, 02451221,021441,w, ETC ETC $GPGSV ETC ETC I know the one I am looking for and will have to test for that before I return the string as well. Is this what you are refering to when you say interupt? I figure if I can get a return of all of them I will be well on my way. I have to get the GPS unit back in my ofice to test. I am going to first hook it up to the HyperTerminal in Windows to make sure i am getting a string passed to the Port. Then get the code running to return the string inside Access. Is the MSComm1.input specific for your cell phone modem? Is this what you are erfering to when you talk about interupt. |
|
#6
|
||||
|
||||
|
Hi Jay,
the MSComm1.Input will give a result, no watter what is connected on the other side ![]() You just need to desifer the incomming stream(interupt) but it seems that you already now what you are looking for($GPGSV) ![]() You can just hook it up to the port and use the onCom event to get the input ![]() Let me know if you need anything else ![]() Cheers Jako AKA noFriends |
|
#7
|
|||
|
|||
|
Accessing Com Port
I need to get the GPS Unit in house and give this a try....thank you much for your help....and if I do have any other issues I will be posting them here....
THanks again..... |
|
#8
|
||||
|
||||
|
no problem, and good luck
![]() |
|
#9
|
|||
|
|||
|
Accessing Com Port
I have been trying to get the NMEA to read in the hyper terminal on my lap top. I have an output beign displayed but it is all coded text...I cant read it. I made sure the settings in the Trimble Unit were set in the hyper terminal:
Baud 9600 Data bits 8 Stop Bits 1 Parity Odd In the hyper terminal there are other settings......What about the: Transfer Protocol? Emulation / Terminal? Thanks Jay |
|
#10
|
|||
|
|||
|
I ahve the Hyper Terminal reading now....starting to work on the coding....thanks for your help so far.....
Jay |
|
#11
|
|||
|
|||
|
If I place your code with the one modification ($GPGGA) it should pop me a message box right?
I placed this code in an Access Database at the end of my code in a form. I am sucessfully getting the NMEA strings at the Comm Port. I can see them in the Hyper Terminal. Now I just need to grab that string and bring it into Access..... CODE: Private Sub MSComm1_OnComm() Select Case MSComm1.CommEvent Case "$GPGGA" buffer = MSComm1.Input MsgBox StrConv(buffer, vbUnicode) Case Else MsgBox "Unknown error or event" End Select End Sub |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Accessing Com Port |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|