|
-
November 2nd, 2003, 02:58 PM
#1
Mscomm
Hello All-
This is my fist time posting on the board but I read your information all the time. I haven't been able to find exactly what I need to hopefully someone is out there who can address my question.
So....
As a part of my senior project, I'm hooking up a GPS unit to my computer through VB6, which posts paragraphs of data every second. It will be used to load the coordinates into a MYSQL database to be used for a vehicle tracking webpage. My problem arises with the MSCOMM control. I am using a click control that periodically calls the MSCOmm1_oncomm() subroutine. With in this subroutine I ask if MSCOMM1.commevent has happened because once the recieve buffer has something in it, i want it to download the whole paragraph for that second from the receive buffer. My non functioning code is as follows:
********************************************
Private Sub MSComm1_OnComm()
'set up the comm ports to 4800 baud
MSComm1.CommPort = 1
MSComm1.Settings = "4800, N, 8, 1" specified by the GPS
MSComm1.InputLen = 0 'indetermined amount of data
MSComm1.PortOpen = True
MSComm1.RThreshold = 1
waiting:
If MSComm1.CommEvent = comEvReceive Then
'For pointer = 1 To 30000000
'Next pointer
For pointer = 1 To 300 'cheexy delay so i get all the
Next pointer 'of the paragraph
buffer = MSComm1.Input 'takes what is in the receive buffer
Print buffer
Else: GoTo waiting
End If
MSComm1.PortOpen = False
End Sub
*************************************************
now I know that the gps can communicate with the code because when I step through it, the code downloads and the buffer has the data in it. I have also tried to put all this code under the click control and not calling a sub routine. Both do not work. My problem is, when I just execute the program, it gets locked into the wait loop forever. For some reason the condition never happens that MSCOMM1.commevent = 2. But then if I ctrl break the program and print the contents of MSCOMM1.commevent it is equal to 0, i guess meaning no events or errors have occured. But then if I step through one "waiting" loop again, the program seems to works.
Any hints or suggestions would be really needed, especially since this needs to be done by friday. Ohh yeah, I have gotten it to work if I use this code
*************************************************
'set up the comm ports to 4800 baud
MSComm1.CommPort = 1
MSComm1.Settings = "4800, N, 8, 1" specified by the GPS
MSComm1.InputLen = 0 'indetermined amount of data
MSComm1.PortOpen = True
For pointer = 1 To 30000000 'this is just a one second delay
on my machine
Next pointer
buffer = MSComm1.Input 'takes what is in the receive buffer
Print buffer
MSComm1.PortOpen = False
******************************************
Thanks again for your help in advance. I really appreciate it.
Marko
-
November 2nd, 2003, 04:03 PM
#2
further information needed
I just wanted to let you all know that I dont' know how long the paragraph is either. The GPS has a number of different paragraphs that it will send and they are different depending on how many satelites it is in contact with and what second it is. So i do not know the number of characters the GPS will be sending.
-
November 2nd, 2003, 04:59 PM
#3
Hey Bignin, I completed a project almost identical. Except I pulled the gps info from the buffer and parsed the text to display speed, and direction with a compass that spins on a form. I dont know much about the data base your working on but you are welcome to my project code if you are interested. Let me know and Ill zip it and post.
BTW I use Garmin, XL-12 and E-Trex
R.L.T.W. A+, NET+, CCNA
doin' my best
-
November 2nd, 2003, 06:53 PM
#4
for sure
Yeah I would love any thing you can help me with. I have trouble shooted a lot more now and I MSComm1.commevent is just not changing from 0 to anything. When its stuck in the loop is doesn't recognize that there is data in buffer. my email is [email protected] if you can't get it from the profile. Thanks for all your time and thought
Makro
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|