Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

I want to receive rs232 text use VB6 for SIM900D GPRS/GSM module.

Status
Not open for further replies.

Microcontroller_Lover

Newbie level 5
Joined
Jan 19, 2013
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,342
I use SIM900D module and interface it use software. I write that software code use VB 6.0. But I face a problem. If a incoming call in my gprs module that time my module send “RING” string. I see it a text box. But I want to do that when my RS232 receive “RING” that time does something like as Beep. My software work normally but when my module send “RING” that time code not working. What is problem?
Here my code:-
Private Sub Command1_Click()
MSComm1.Output = Text1.Text & Chr(13)
End Sub

Private Sub Form_Load()
MSComm1.PortOpen = True
MSComm1.Settings = "9600,n,8,1"
MSComm1.DTREnable = False
End Sub
Private Sub MSComm1_OnComm()
Dim data As String
If MSComm1.CommEvent = comEvReceive Then
data = MSComm1.Input
End If
End Sub
Private Sub Timer1_Timer()
Dim inputBuffer As String
inputBuffer = MSComm1.Input
If inputBuffer = "RING" Then
Text3.Text = "Beep"
Beep
End If
Text2.Text = Text2.Text & Chr(13) & inputBuffer
If (LCase$(inputBuffer) = "0") Then
Chr (13)
End If
End Sub

View attachment Corrected serial communication with beep.rar
 

HiHo, are you fine?

I'm making a track system using a SIM900D and when there is a incoming call, the pin RI (pin 4) goes to low until you or the sender hang up the phone. What if this approach?

Regards.
 

i am not fine. :cry: because my code not working. what about you ? i not check it "pin RI (pin 4)" actually i want to develop a software. which have all option like as mobile phone.

- - - Updated - - -

i am not fine. :cry: because my code not working. what about you ? i not check it "pin RI (pin 4)" actually i want to develop a software. which have all option like as mobile phone.

- - - Updated - - -

the RI is not 4 no PIN for SIM900D. its 11 no PIN. Plateau bro :grin:
 

So sorry, my friend. I've opened the SIM900 datasheet instead of the SIM900D. haha :-D

Well... I don't remember, but when you receive the "RING", the SIM900D sends a line feed (x0D) and a carrier return (x0A) before the "RING". After you receive the first "RING", I think you need to turn off the USART because the SIM900D will send "RING" until someone hangs up or after some tries.

I know nothing about VB6 but in C I'll need to do these steps.

Regards,

Pedro Rosa.
 

What is the purpose of putting the below code inside Timer routine?
Code:
Private Sub Timer1_Timer()
Dim inputBuffer As String
inputBuffer = MSComm1.Input
If inputBuffer = "RING" Then
Text3.Text = "Beep"
Beep
End I
 

Hi Hi i also think you open SIM900.. because (SIM900-SIM900D) same without D . :lol:
SIM 900D sends a line feed (x0D) when ? before "RING" or after "RING" or chr 10 &"RING" or "RING" & chr (10) ?

- - - Updated - - -

@ jayanth.devarayanadurga bro
when i receive "RING" in rs232 that time i hear beep and Text3.Text box show beep
 

Sorry, I dont have VB6. I have VB.net 2012. I can help you with VB.net code. I am not able to open your project files as I don't have VB. So, just send me the VB code in a text file. Do you want me to transport the VB code into VB.net code?

Ok. I got it. Is the code shown in the image the code you are using?

Try this code

Code:
[syntax=vb]
Private Sub Command1_Click()
	If Text1.Text <> "" Then
		MSComm1.Output = Text1.Text
	End If
End Sub

Private Sub Form_Load()
	MSComm1.PortOpen = True
	MSComm1.Settings = "9600,N,8,1"
	MSComm1.DTREnable = False
End Sub

Private Sub MSComm1_OnComm()
	Dim data As String

	If MSComm1.CommEvent = comEvReceive Then
		data = MSComm1.Input
		If data = "RING" Then
			Text3.Text = "Beep"
		End If
	End If
End Sub
[/syntax]
 

Attachments

  • vb code.jpg
    vb code.jpg
    53.8 KB · Views: 53
Last edited:

Brother which is bast VB or VB.net ? @jayanth.devarayanadurga

- - - Updated - - -

yes this is code. its working normally. but not working when incoming my module. :(
 

my module send "RING" when incoming a call.
if you want you connect my pc and see this.......... :sad: ...
 

So your module sends the string "RING". Right?

Try this code. Which COM port are you using on the PC side?

Code:
 [syntax=vb]
Private Sub Command1_Click()

	If Text1.Text <> "" Then
		MSComm1.Output = Text1.Text
	End If

End Sub

Private Sub Form_Load()

	MSComm1.Settings = "9600,N,8,1"
	MsCOMM1.ComPort = 1
	MSComm1.DTREnable = False
	MSCOmm1.RTSEnable = False
	MSComm1.Handshaking = 0
	MSComm1.PortOpen = True

End Sub

Private Sub MSComm1_OnComm()

	Dim data As String

	If MSComm1.CommEvent = comEvReceive Then
			
		data = MSComm1.Input
		If data = "RING" Then
			Text3.Text = "Beep"
		End If
	End If
End Sub
[/syntax]
 

plz give me your FB address. my account is.....
faecbook.com/xmanemran

- - - Updated - - -

data send but. not receive ant data. @jayanth.devarayanadurga
 

Hi believe this post is closed long ago. But my issue is somewhat same. I am receiving data on RING and message. Starting with words "RING" and "+CMT". I am getting data on port with particular syntax for RING and Message like for ring "RING+CLIP: "+919860939518",145,"",,"",0" and for message "+CMT: "BP-bytwoo",,"14/08/02,13:16:41+22 9860939518:hello6". I have created a hyper terminal in Textbox1. Getting data of text1 in text3. Then Storing data in a variable called 'str'. Then looking for string RING and +CMT in the data extracted from text3 using 'str_1 = Mid(Text3, 1, 6)' and display in text4. I am able to extract words RING and +CMT. Then I check that if data extracted is equal to RING then extract the number and display it in textbox2, or if data extracted is equal to '+CMT' then display the data in text box 5. But even though string 'RING' and '+CMT' are extracted successfully, i am not able to retrieve the phone numbers which has to be displayed in textbox2 and textbox5. These text boxes shows absolutely nothing. I don't understand why it is happening. Please guide me. Here is my code.
Code:
Private Sub MSComm1_OnComm()
  Static Buffer As String

  t = Now() + timeout / 86400000#


          If MSComm1.CommEvent = comEvReceive Then
             Do
               Text1 = Text1 + MSComm1.Input
               If Now() > t Then Exit Do
             Loop
             Text3 = Text1
             Text1 = ""
          End If


  str = Text3
  str_1 = Mid(Text3, 1, 6)
  Text4 = str_1

          If (str_1 = "RING") Then
              Text2.Text = Mid(str_1, 19, 13)  'Left$(str_1, 15) 

          ElseIf (str_1 = "+CMT") Then                  
              Text5.Text = Mid(str_1, 19, 13)   '19,13
          Else
              Exit Sub
          End If


  MSComm1.InBufferCount = 0

  End Sub


Compiler not even goin in loop 'If(str_1="RING") Then'. Why is it so. IF this post is still going on, can any one help me.
 

are you sure that your string str_1 contains no spaces or other characters
try using the InStr() method to search a string for a string
https://msdn.microsoft.com/en-GB/library/8460tsh1(v=vs.90).aspx

e.g. if it returns a value > 0 the string is found - inthe following case TestPos value is 2
Code:
        Dim SearchString As String = " RING  "
        Dim SearchChar As String = "RING"
        Dim TestPos As Integer
        TestPos = InStr(SearchString, SearchChar, CompareMethod.Text)
        Console.WriteLine("TestPos {0}", TestPos)
 

I made changes suggested by you horace as follows,

Code:
Private Sub MSComm1_OnComm()
Static Buffer As String
    If (Text1 <> "") Then
        Text1 = ""
    End If
'Sleep 10
Dim Testpos As Integer

t = Now() + timeout / 86400000#


If MSComm1.CommEvent = comEvReceive Then
 Do
  Text1 = Text1 + MSComm1.Input
  If Now() > t Then Exit Do
Loop
  Text3 = Text1
 End If
str_2 = "RING"
str_3 = "+CMT"


Testpos = InStr(1, Text3, "RING")
Text7 = Testpos        ''''''-----------------------> Testpos number is 3<---------------------------   
If (Testpos <> 0) Then
str = Trim$(Text3)
'str_1 = Mid(Text3, 1, 6)
str_1 = Left$(str, 6)
Text4 = str_1
        
            If (str_1 = "RING") Then
                'str = Left$(str, 19)  'Left$(str_1, 15) '-----------22,10------------
                Text3 = Trim$(Text3)
                str = Mid$(Text3, 19, 13)
                Text2 = str
                  
            End If
        
End If
        
'Text2 = str
'----str_1 = Left$(str_1, 3)
'----        If (str_1 <> "+91") Then
'----            Exit Sub
'----        Else
'----            Text3 = Mid(str, 22, 10)
'----        End If
'Text1.SelStart = Len(Text1.Text)
'Text1.SelText = str_1

'MSComm1.InBufferCount = 0
'Text1 = ""
End Sub

But still If-Else condition is failing.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top