473,396 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Serial Communication in C#.net

366 256MB
HI,
I am developing an application using C#.net2.0 FrameWork ,in which communication with GSM modem is mandatory.The main aim of my application is it should interact with GSM moden for sending messages and as well as receiving messages .Presently i am mscomm available in C#.net2.0 .the problem is i can just send the message to the serialport(RS-232) but unable to interact with the modem .
Any suggestions Plz.
Jul 15 '06 #1
15 21806
sashi
1,754 Expert 1GB
Hi there,

pls post you code segment in your next.. as that will be alot more easier to assist you.. we will help you to validate your code.. good luck my fren.. :)
Jul 15 '06 #2
nmsreddi
366 256MB
hi sashi,
First thanks for ur support,i am giving my partial code regarding mscomm so that i may more benifit
*****************code*********************
private void InitComPort()
{
// Set the com port to be 1
com.CommPort = 1;

// This port is already open, close it to reset it.
if (com.PortOpen) com.PortOpen = false;

// Trigger the OnComm event whenever data is received
com.RThreshold = 1;

// Set the port to 9600 baud, no parity bit, 8 data bits, 1 stop bit (all standard)
com.Settings = "9600,n,8,1";

// No handshaking is used
com.Handshaking = MSCommLib.HandshakeConstants.comNone;

// Don't mess with byte arrays, only works with simple data (characters A-Z and numbers)
com.InputMode = MSCommLib.InputModeConstants.comInputModeText;



// Read the entire waiting data when com.Input is used
com.InputLen = 0;

// Don't discard nulls, 0x00 is a useful byte
com.NullDiscard = false;

// Attach the event handler
com.OnComm += new System.EventHandler(this.OnComm);

// Open the com port
com.PortOpen = true;
}

private void OnComm(object sender, EventArgs e) // MSCommLib OnComm Event Handler
{
// If data is waiting in the buffer, process it.

if (com.InBufferCount > 0) ProcessComData((string) com.Input);
}

private void ProcessComData(string input)
{
// Send incoming data to a Rich Text Box
rtfTerminal.AppendText(input + "\n");
}

many thanks
msreddy
Jul 15 '06 #3
nmsreddi
366 256MB
HI,
I am developing an application using C#.net2.0 FrameWork ,in which

communication with GSM modem is mandatory.The main aim of my application is

it should interact with GSM moden for sending messages and as well as

receiving messages .Presently i am mscomm available in C#.net2.0 .the

problem is i can just send the message to the serialport(RS-232) but unable

to interact with the modem .
Any suggestions Plz.

with regards
nmsreddy
__________________________________________________ ________________________
hi sashi,
First thanks for ur support,i am giving my partial code regarding mscomm so

that i may more benifit
*****************code*********************
private void InitComPort()
{
// Set the com port to be 1
com.CommPort = 1;

// This port is already open, close it to reset it.
if (com.PortOpen) com.PortOpen = false;

// Trigger the OnComm event whenever data is received
com.RThreshold = 1;

// Set the port to 9600 baud, no parity bit, 8 data bits, 1 stop bit (all

standard)
com.Settings = "9600,n,8,1";

// No handshaking is used
com.Handshaking = MSCommLib.HandshakeConstants.comNone;

// Don't mess with byte arrays, only works with simple data (characters A-Z

and numbers)
com.InputMode = MSCommLib.InputModeConstants.comInputModeText;



// Read the entire waiting data when com.Input is used
com.InputLen = 0;

// Don't discard nulls, 0x00 is a useful byte
com.NullDiscard = false;

// Attach the event handler
com.OnComm += new System.EventHandler(this.OnComm);

// Open the com port
com.PortOpen = true;
}

private void OnComm(object sender, EventArgs e) // MSCommLib OnComm Event

Handler
{
// If data is waiting in the buffer, process it.

if (com.InBufferCount > 0) ProcessComData((string) com.Input);
}

private void ProcessComData(string input)
{
// Send incoming data to a Rich Text Box
rtfTerminal.AppendText(input + "\n");
}

many thanks
msreddy
Jul 17 '06 #4
Banfa
9,065 Expert Mod 8TB
How do you make the modem dial?
What sort of messages are you sending to it?

Having opened a port to a modem you should be able to interact with it using the Haynes command set (as extended for GSM/GPRS/3GPP modems).
Jul 17 '06 #5
nmsreddi
366 256MB
hi banfa
i am using wavecom gsm modem ,i got succes doing it in VB6.0 by using mscomm object .In that modem i am my local network SIM (any provider) just we use in our mobile phone .But the only difference for modem works only for sending and receiving messages even for our mobile or any other similar device
When comming to message formats it is related to our company device ,the message consists of 4 characters staring with # and ending with !.
I think this information may guide u to understand my application


withregards
nmsreddi
Jul 22 '06 #6
Hai...
Seems i also hav a problem regarding ur topic.
I hope ur kind help....
Im developing a software using C# to send SMS messages automatically. Really its a part of a building monitoring software.Im using a Ericsson T-10s for my task. I hav testet the phone with AT commands using hyper terminal. Dats fine...Nw how can i send AT commands to the phone via serial port using C# . My program should send SMS messages automatically..
Hope ur support....
Thanks..
Sep 13 '06 #7
Banfa
9,065 Expert Mod 8TB
Look up

system.io.port
Sep 13 '06 #8
nmsreddi
366 256MB
banfa

tanks for your response


but the problem system.io.ports

name space is not available in .Net1.1 version it is available from .Net2.0 on wards

ok any how thanks i am trying in .net2.0 also but but unable to intyeract with the modem the code which i have given previously is ,able to send data to buffer(rs-232 port ) but from i cannot communicate with the hardware

Hope you may respond soon


regards

nmsreddi
Sep 14 '06 #9
Hey guys.......

Waiting for ur attention. Hope i would find some help frpm u guys. Thanks...
Im using visual studio 2005.
Sep 14 '06 #10
kisnam
3
Hi guys,

Im happy to see u ppl discussing on c# code to send SMS... I want to send Multimedia messages to mobile... for eg: images, video, r may include both.. how to set attributes in c#.net i may send and receive MMs thru my application (ofcourse developed in c#)....
Oct 9 '06 #11
Mobeen
1
Hi guyz
Can any one send me the complete source code for this application (SMS using C#.NET) ?

will b grateful to u...

desperately waiting 4 reply.

Regards

Mobeen
Nov 1 '06 #12
Hi, I think it is a lot of pain to program RS232 to send SMS messages and once the number of messages goes and you have to switch to IP SMS you have to do it again. A better solution is to use an SMS Gateway. This article gives information about C# SMS Gateway technology.
Aug 22 '07 #13
cph05a
1
I'm working with the Symbol MC35 (running windows mobile) and I'm attempting to read from the serial port using the SerialPort class in .NET. I've gotten my program to run properly my laptop, but it doesn't seem to work on the MC35. It finds the serial port and opens it successfully, but never seems to get any input. Does the MC35 support reading from the serial port?
Feb 5 '08 #14
I have written code here, just check this link:
[Link Removed]
Mar 3 '08 #15
MMcCarthy
14,534 Expert Mod 8TB
@ Rajeshshewale

If you wish to submit code please submit it in the thread and not using a link.

ADMIN
Mar 3 '08 #16

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Andreas Horneff | last post by:
Hi @ all, I've got a problem with serial communication in Borland C++ Builder. I've already found a lot of stuff about serial communication in the internet, but it dosen't work. What I want...
11
by: sarah | last post by:
hI, I have a project. I need to realise serial communication between PC and Altera FPGA in c or c++. The function of FPGA is working well. it can send data to uart. Does anybody know how to...
3
by: carmen | last post by:
I'm working in an aplication for a Smart Device that need to "talk" with a printer continuosly through the serial port. I'm trying to use the John Hint's sample code "Use P/Invoke to develop a .NET...
4
by: Vidya Bhagwath | last post by:
Hello Experts, I am porting the C++ code into the Visual C#.NET. My C++ code is mainly based on the serial communication. So I am using the windows structure such as DCB.. etc and the windows...
6
by: Leandro Berti via DotNetMonster.com | last post by:
Hi All, I wrote a code to do serial communication with an equipament. When i use the code outside of threaded class it seens work properly, but when i put inside a class and execute a thread in...
4
by: joe bloggs | last post by:
I am writing a mobile application to interface with a legacy system and I am planning to use web services to communicate with this system. The legacy system receives data through a serial port. ...
2
by: Marco Trapanese | last post by:
Hi, every 250 ms (timer event) I must send several commands via serial port. The serial unit will answer to each command sent. I must wait the answer before send the next command. How can I...
4
by: max_mont | last post by:
Hi all, I'm a newbie in .NET technology. I've already developed Serial communication applications in C++ (WIN32). And I wanted to migrate to .NET technology. There is a serial component in...
2
by: Adrian Chen | last post by:
please help me! I come across a problem. Now I develop a finger print management system which is based on B/S.When users click a button in the web pages, a device connected to the COM1 serial port...
0
by: Dhananjay | last post by:
Hi, I am working on an VB.Net application which I want to communicate to external device using comm port (Serial Port) . So for that first I am trying to simulate the communication on serial...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.