June 3rd, 2014, 05:10 AM
GSM data shifting continuously
I have written a code to get the GSM data on serial port. So when GSM module get's a call it sends the data
However this data keeps on shifting towards right or left. I want to extract the phone number from this data. I thought of detecting first two word i.e RING+CLIP, using Instr function. However even it is present in incoming string, it's giving value 0' it means string is not present in given string. So i can not extract phone number. Moreover data keeps on shifting, so position of those two words is also not fix. Here is the code,
How to stop shifting of data, and extract desired number from this.
Dim str As String
Dim val As Integer
Dim str_1 As String
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Form_Load()
On Error GoTo errx:
Dim strValue As String ' define Buffer value from Modem
MSComm1.CommPort = 6 'comm port no.
MSComm1.Settings = "9600,n,8,1"
MSComm1.RThreshold = 47 'no. of chr to receive
MSComm1.InputLen = 0 ' no. of chr on which oncomm event fires
MSComm1.PortOpen = True 'open comm port
MSComm1.Output = "AT + CLIP = 1" + Chr(13)
Private Sub MSComm1_OnComm()
'str = " RING+CLIP"
Select Case MSComm1.CommEvent
str_1 = Text1.Text
Text2.Text = InStr(str_1, "RING+CLIP")
''Text3.Text = Mid(str, 22, 10)
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!