Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

communicating via the serial port 1

Status
Not open for further replies.

jimboo

MIS
Mar 15, 2002
18
GB
Hi,

I am trying to communicate with my desktop computer using my siemens handheld pc via a serial cable. I know i need to use the MScomm control, but am failing badly.

What i need is a piece of code that, when a user clicks on an image on the handheld pc it changes an image on the desktop pc. Does anyone know how i can do this?

any help would be appreciated.

Jim.
 
Do you have communication between the two and need the code to change the image or changing the image is you final objective and you can't get the devices to communicate? Anything is possible, the problem is I only have one lifetime.[thumbsup2]
 
I can get the 2 to communicate via MS activesync, but not via my VB program.

Changing the image is my final objective and i can't get the devices to communicate.
 
Just so I know, are you developing apps for both the handheld and the desktop? If so what platform does the siemens use under (assuming) embedded VB3.0? Are you trying to use the siemens' device cable to connect or some other adapter? Anything is possible, the problem is I only have one lifetime.[thumbsup2]
 
Just so I know, are you developing apps for both the handheld and the desktop?

The app on the desktop displays a picture and places a random cross on it. The handheld displays the same image (only smaller), without the cross. The user has to click on the small image where they think the cross would appear. When the user clicks this image i want it to send a message to the desktop to draw another random cros, and so on.

If so what platform does the siemens use under (assuming) embedded VB3.0?
Correct the program for the siemens simpad is written in embedded vb3 and the desktop program in vb6

Are you trying to use the siemens' device cable to connect or some other adapter?

i am using the device cable that came with the siemens handheld. It connects to the com port on the desktop and a serial port on the handheld.

 
jimboo,

I am looking into it. It might take me some time though. I will keep posting to this thread as things develop. Let me know if you come up with anything. Anything is possible, the problem is I only have one lifetime.[thumbsup2]
 
I wondered if you had got anywhere with this? I am still struggling.

Jim.
 
Jim,

The biggest problem I am having is working around the ActiveSync app as it takes charge of the port that the device connects to. If I can find a way to interface with it to allow me to gain access to the port I will be able to make some progress. Anything is possible, the problem is I only have one lifetime.[thumbsup2]
 
it doesn't have to connect through ActiveSync, does it? i only mentioned activesync to demonstrate i can connect the desktop tot the handheld the device. Or am i just getting confused? arrrrrrrgh!!!
 
I don't think it does, but that is the problem. I can't seem to get around the ActiveSync service, it takes control of the port and if I try to connect with a different port the ActiveSync service takes control of that port. Anything is possible, the problem is I only have one lifetime.[thumbsup2]
 
what about removing active sync, would that help?
 
Ok Jim here we go. This is what I had to do.

1. Right click the ActiveSync systray Icon and Deselect the "Allow serial cable or infrared connection to this Comport" option under connection settings

2. Place this code in the eMbedded VB App

Private Sub cmdChange_Click()
comPort1.Output = "Change"
End Sub

Private Sub Form_Load()
If Not comPort1.PortOpen Then
comPort1.PortOpen = True
End If
End Sub

Private Sub Form_OKClick()
comPort1.PortOpen = False
App.End
End Sub

You need to reference the MSComm conrtol which is a dll in the default directory in the devctrls folder.

3. Place this code in you Desktop app

Private Sub cmdExit_Click()
comPort1.PortOpen = False
Unload Me
Set frmMain = Nothing
End Sub

Private Sub Form_Load()
If Not comPort1.PortOpen Then
comPort1.PortOpen = True
End If
End Sub

Private Sub tmrPoll_Timer()
If comPort1.InBufferCount > 0 Then
If CStr(comPort1.Input) = "Change" Then
' Process Change to Image or what ever
End If
End If
End Sub

The comPort object needs to be set the same for both projects and set for text. I just used a timer to poll the com port on the desktop project but that can be done however you would like. I also just sent a text string ("Change") out from the handheld by the press of a command button. I did not do any error checking or anything as I was kind of pressed for time. Hope that at least gives you a start. Anything is possible, the problem is I only have one lifetime.[thumbsup2]
 
Hi,

thanks for all the time you put into this. I would have been really stuck without your help.

Cheers, Jim.
 
Sorry to be a pain,

but you say i need to reference the MScomm Control. Ok, so i've found the dll,

1) how do i reference it? (prob easy, but i'm a beginner)
2) do i need to place the mscecomm.dll file on the handheld?

hopefully be the last question, cheers!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top