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.

VB code for GSM interfacing

Status
Not open for further replies.
Code:
   MSComm1.RThreshold = 47    'no. of chr to recive
   MSComm1.InputLen = 0  '  no. of chr on which oncomm  event fires

It doesn't matter if i increase number of characters to be received. It will give same data repeatedly. Yes I may be loosing some data. If hyperterminal is running then just before receiving the call 'NO CARRIER' signal initiates, then it may merge with specified format and with the AT command .
 

I think you need to read a line of text (up to the new line character) then check its contents
as MSComm does not have a readLine method you can read character by character adding to a string until you get end of line
e.g. I don't have VB6 or MSComm so am using the SerialPort class in Visual Express VB 2010
Code:
Imports System.IO.Ports
Module Module1

    Sub Main()
        Dim serialPort As System.IO.Ports.SerialPort
        serialPort = New SerialPort()
        serialPort.PortName = "COM7"
        serialPort.BaudRate = 56700
        serialPort.Open()
        While True
            Dim data As String = ""
            Dim ch As String
            ' loop reading characters from serial line until end of line character 
            Do
                ch = ChrW(serialPort.ReadChar)
                data = data & ch
            Loop While ch <> vbCr ' Carriage Return is end of line
            Console.WriteLine(data)
            ' now check the contents ...
        End While
    End Sub

End Module
I have a Microchip Explorer 16 board attached to COM7 which sends Carriage Return as the end of line
a modem may well be different, e.g. vbLf line Feed

SerialPort has a ReadLine method so makes this process much simpler

why not download Microsoft Visual Express VB?
 
Last edited:

Do
ch = ChrW(serialPort.ReadChar)
data = data & ch
Loop While ch <> vbCr ' Carriage Return is end of line
Console.WriteLine(data)
' now check the contents ...
End While
End Module[/CODE]

I hope you are converting incoming string into character and checking for end of character. Do VB6 has any such ready made function.
 

hi horace,

Can you suggest me the event at which message should be received. I have configured the modem to receive the call in form load event. Similarly how to configure the modem to receive message from it automatically. I am finding it very confusing.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top