473,626 Members | 3,201 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help with serial communication

2 New Member
I`m working on an embedded project that implies an external device equiped with microcontroller to communicate via rs-232 with a pc application. I`ve written the pc application in .net C# that receives data using the serial port object provided by .net framework. If I don`t put a delay after the transmit USART function in the embedded device the .net application loose data. If a put a delay the application works fine.
Time is critical for my project. Can anyone please tell me how can I fix this problem ?
Mar 19 '07 #1
2 1171
Cletus Wilbury
1 New Member
I`m working on an embedded project that implies an external device equiped with microcontroller to communicate via rs-232 with a pc application. I`ve written the pc application in .net C# that receives data using the serial port object provided by .net framework. If I don`t put a delay after the transmit USART function in the embedded device the .net application loose data. If a put a delay the application works fine.
Time is critical for my project. Can anyone please tell me how can I fix this problem ?
I've worked on similar problems, and it helps if you can analyze the timing carefully.
If you need to look at the data coming across with precise time stamping, my friend has designed a useful device just for that purpose.

EZ-Tap

Comes with Windows software to read/store/display data the device sends out on USB port.

EZ-Tap forum

I just set up that forum, first time I've ever done it, seems to work?
Mar 24 '08 #2
Plater
7,872 Recognized Expert Expert
Firstly, if you are using a USB->Serial converter, there is really not anything you can do, the lag is due to the conversion between serial and usb (and back) withen the drivers/hardware for the device.

If you're using a hardware uart on the pc side (built in serial port), check how you do the reads. (Don't do them only in the DataReceived event because you will miss some events and fall behind)
Mar 24 '08 #3

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

Similar topics

2
4121
by: kamarudin samsudin | last post by:
Hi all, I try to invoke python serial script via my browser using PHP (exec function). For the serial communication, i used pySerial module. It fine when it run it as root but when i try to run it from browser, i got this error in my httpd/error_log File "weather1.py", line 9, in ? ser=serial.Serial('/dev/ttyS0',9600,timeout=1) File "/usr/lib/python2.3/site-packages/serial/serialutil.py", line
1
9897
by: Jamil | last post by:
I have a target box connected to my desktop (x86 Windows 2000) PC through a serial cable (COM port). The target box running on different processor and OS. The target box needs to send a specific formatted data (2 bytes header + 128 bytes data) asynchronously through the serial port and I've to capture it at the host PC side and save those into a file. I like to have the client-server model. The PC will be a server and start a forever...
6
2855
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 the first seconds the communication is ok, later i receive read/write error. I?ve been in MSDN site and there i discover that the read/write error is a INVALID_HANDLE problem. But why??? I just create the serial communication file and use it....
6
3122
by: Ken | last post by:
When running a program in the debugger, what would cause it to crash without any error messages? I get "The program has exited with code 0 (0x0)". The program is a MDI app with threading for several serial ports. It only crashes when data is being received on one or more of the serial ports. Could someone please give me some ideas about what would cause a program to terminate in this way? Thanks....
0
1291
by: Back 9 | last post by:
Hello, I am converting c++ codes to C# now. When I get to serial communication parts, I found the data types used in C++ are different from C# which is not at all supprising at me. But problem is that in C# there is very convenient class for rs323c communication called SerialPort. It only uses byte date type ( 8 byte unsigned value) or char (16 bit unicode) as input parameter. Neither of them has support a negative value. The old codes...
5
7892
by: Mo | last post by:
Hi, I have an application where I read a serial port data from a barcode and set the labels on a form. I also have a textbox and button where you can enter the data and here is the problem. if I use the textbox and submit using thebutton everything works fine. If I use the SerialDataReceivedEventHandler method of the serial port, the application crahes. It seens like that when the serial port triggers and I call the same routines it is...
0
4554
by: ghjk | last post by:
I want to read sms from GSM modem using C# in serial communication. I wrote the code. But i want to do it automatically. I put my code here and please tell me how can i do it automatically. public partial class SMS : Form { //create an Serial Port object SerialPort sp = new SerialPort(); public SMS() {
4
2130
by: nmsreddi | last post by:
Hi friends , after a long busy work happy to back to forums, i have developed a windows application(C#2,0) for serial communication. the aim of my application is to connect to external device(energy meter in my case) and have to get data from the that device . approximately the time to read complete data frfom meter is 10 minutes(may be more also up to one hour in some cases) ,during this time my application is not allowing...
2
8271
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 of the client machine starts to work. Now I wrote the code which is in charge of serial communication in the ..aspx.cx pages, but then I found that when uses click the button, it is the server's serial port that starts to work,not the clients!! ...
4
3269
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 of the client machine starts to work. Now I wrote the code which is in charge of serial communication in the ..aspx.cx pages, but then I found that when uses click the button, it is the server's serial port that starts to work,not the clients!! ...
0
8705
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8637
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8364
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5574
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4092
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2625
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1808
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1511
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.