View Single Post

  #1 (permalink)  
Old 04-03-2004
Anonymous Anonymous is offline
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Sending SMS to port

I am trying to retrieve, data from port7 and pass it to another computer through SMS, from port1
of same computer.I am using 2 comm controls for same purpose.MSComm1 is commected to port1
and MSComm2 is connected to port2.Now my problem is that, i am able to retrieve data from port1,
but i am not able to SMS it to other computer.ReadMsg(MessageNo) is the procedure to send SMS.
The program do not show any error, but it foes not send SMS either.On debugging, the control passes
through ReadMsg() procedure, but do not send SMS.I am attaching the code with my query.
Do anybody have any idea?
Regards,
BN


Private Sub Form_Load()
If MSComm1.PortOpen = True Then MSComm1.PortOpen = False

MSComm1.RThreshold = 1
MSComm1.RTSEnable = True
MSComm1.Settings = "9600,n,8,1"
MSComm1.CommPort = 7
MSComm1.PortOpen = True
MSComm1.Output = "AT+CMGF=1" & vbCr

End Sub

Private Sub MSComm1_OnComm()

Dim MsgNo
Dim cominput


cominput = ""
cominput = MSComm1.Input

Text1 = Text1 & cominput

If InStr(cominput, "GetPos") > 0 Then
Call PortOpen
ElseIf InStr(cominput, "CMTI:") > 0 Then
MsgNo = (Mid(cominput, InStr(cominput, "SM") + 4))
Text3 = MsgNo
Call ReadMsg(Text3)
End If

cominput = ""

End Sub

Private Sub MSComm2_OnComm()
Text2 = Text2 & MSComm2.Input
End Sub

Private Sub ReadMsg(MessageNo)
Dim str
If MSComm1.PortOpen = True Then MSComm1.PortOpen = False
MSComm1.RThreshold = 1
MSComm1.RTSEnable = True
MSComm1.Settings = "9600,n,8,1"
MSComm1.CommPort = 7

MSComm1.PortOpen = True
MSComm1.Output = "AT+CMGR=" & MessageNo & vbCr

End Sub

Private Sub PortOpen()

If MSComm2.PortOpen = True Then MSComm2.PortOpen = False

MSComm2.RThreshold = 1
MSComm2.RTSEnable = True
MSComm2.Settings = "9600,n,8,1"
MSComm2.CommPort = 4
MSComm2.PortOpen = True

End Sub
Reply With Quote