![]() |
| | #1 |
| Registered User Join Date: Oct 2008
Posts: 1
| Serial port communication timeout I'm implementing a simple protocol to communicate to a device via serial port. My program should: 1)Write a packet 2)Wait till a timer is expired, or exactly N characters are read In other words a complete packet should arrive within a certain time, or the read fails. I've read about termios config (VMIN & VTIME), as well as about open system call flags, but I'm a bit confused and need some clarification. Thanks! John |
| johnfulgor is offline | |
| | #2 |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| VMIN and VTIME is a bit tricky to get right. I think, if you have a set packet size, then you can set VMIN to the number of characters, and VTIME to the timeout value. If you have a variable packet size, then you will need to use a different technique - the best way is to set it up so that you have a short timeout, and then use a different mechanism (such as a timer) to detect overall timeouts. -- Mats
__________________ Compilers can produce warnings - make the compiler programmers happy: Use them! Please don't PM me for help - and no, I don't do help over instant messengers. |
| matsp is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| serial port to poll on request | infineonintern | C++ Programming | 2 | 06-11-2009 06:52 AM |
| Duplex communication thro serial port | Priyachu | Networking/Device Communication | 1 | 05-30-2009 04:24 AM |
| Duplex communication thro serial port | Priyachu | Linux Programming | 1 | 05-30-2009 04:03 AM |
| DOS, Serial, and Touch Screen | jon_nc17 | A Brief History of Cprogramming.com | 0 | 01-08-2003 04:59 PM |
| Need help or info about serial port communication | Unregistered | Linux Programming | 1 | 01-08-2002 01:48 PM |