- #1
- 8,142
- 1,759
I am having a first go at integrating a PC based VB application with some other types of industrial computers. I wrote a simple VB routine that calls up the driver [for the PC to Industrial connection] as an executable file. This all works fine. The program dials in, gets the data, and closes the exe with no problem. The problem is that whether or not I actually shell to the exe, the modem intialization string seem to be causing me problems. When I am done I can't get the modem to disconnect. This is what I am doing.
For dial out:
If MSComm1.PortOpen = False Then
Call mnuCommPortOpen_Click
End If
MSComm1.Output = "AT &D0 &R1 &B1" & vbCrLf
DialString = "ATDT" & DialNumber & vbCrLf
MSComm1.Output = DialString
Once it connects I set MSComm1.PortOpen = false. I need to do this to free up the port for the other application. After I retrieve the data, I attempt to hang up like this.
If MSComm1.PortOpen = False Then
MSComm1.PortOpen = True
End If
If MSComm1.PortOpen = True Then
MSComm1.Output = "+++" & vbCrLf
MSComm1.Output = "ATH0" & vbCrLf
MScomm1.Portopen = false
End If
My modem control skills really stink and I haven't worked with Basic in a very long time, so I'm not sure if this is a VB problem or a modem control problem. I thought that a simple ATH0 should do it, but something about the intialization prevents this from working. Then I thought that I must have to go back into command mode, so I added the +++, but no good. Does anyone know what's going on?
Edit: This all uses a standard Hayes compatible, V90 modem
For dial out:
If MSComm1.PortOpen = False Then
Call mnuCommPortOpen_Click
End If
MSComm1.Output = "AT &D0 &R1 &B1" & vbCrLf
DialString = "ATDT" & DialNumber & vbCrLf
MSComm1.Output = DialString
Once it connects I set MSComm1.PortOpen = false. I need to do this to free up the port for the other application. After I retrieve the data, I attempt to hang up like this.
If MSComm1.PortOpen = False Then
MSComm1.PortOpen = True
End If
If MSComm1.PortOpen = True Then
MSComm1.Output = "+++" & vbCrLf
MSComm1.Output = "ATH0" & vbCrLf
MScomm1.Portopen = false
End If
My modem control skills really stink and I haven't worked with Basic in a very long time, so I'm not sure if this is a VB problem or a modem control problem. I thought that a simple ATH0 should do it, but something about the intialization prevents this from working. Then I thought that I must have to go back into command mode, so I added the +++, but no good. Does anyone know what's going on?
Edit: This all uses a standard Hayes compatible, V90 modem