![]() |
| | #1 |
| Registered User Join Date: Jan 2008
Posts: 19
| Sending 1 bit to serial port Anybody know if there is a very simple way of sending 1 bit to like a serial port? I have been reading a few things that seem like they do it but I am not for sure. |
| blackcell is offline | |
| | #2 |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| That obviously depends on the serial port. The "standard" Asynchronous device, e.g. the 8250/16550 type devices in a PC [or any other UART device that I personally know of] are only able to send "lumps" of bits, e.g. 5, 6, 7, 8 bits [plus a start/stop bit at either end of the "lump"]. What are you ACTUALLY trying to achieve, bigger picture like? -- 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 | |
| | #3 | |
| Registered User Join Date: Mar 2008
Posts: 14
| reply What are you using Unix/Linux or Windows? In linux just open the serial port /dev/ttyS? or something like that and write() to it sth like Code:
int serial_handle;
serial_handle = open("/dev/ttyS0", O_RDWR);
O_RDWR is the flags that opens it for read and write. and then write() to it but like matsp said Quote:
| |
| scioner is offline | |
| | #4 |
| Registered User Join Date: Jan 2008
Posts: 19
| Sorry, lumps of bits will work. What I want to do is replace an ancient buzzer system. I think I will be using windows server 2003 by the way. Basically I want to set schedules and on the schedules execute my code to send traffic down a serial port which will trigger something on the other end when traffic is detected. Oh, and another thing is I didn't know if it could be that easy. I am no expert when it comes to devices like serial but I think there is an onboard rom chip that does some processing and channeling when receiving data down the serial pipe? Or am I wrong. Thanks again guys ( and girls? ) |
| blackcell is offline | |
| | #5 |
| Registered User Join Date: Mar 2003
Posts: 3,844
| For serial port I/O under windows - there are plenty of examples out in the wild. All of them will be using the API's and concepts described in this article: Serial Communications in Win32. What's the name of the device you're connecting to? What are the connection settings (baud, parity, stop bit, flow control)? Is the serial protocal for the device published online? gg |
| Codeplug is offline | |
| | #6 |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| If you just want to trigger something, wouldn't the parallel port of the PC be a better choice. It's got 8 pins that you can set to 0 or 1 individually. -- 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 | |
| | #7 |
| Registered User Join Date: Jan 2008
Posts: 19
| Using serial instead of parallel because of distance capabilities. Also, on the receiving end it seems to be irrelevant. The guy taking care of that says that all he needs to do is have anything flow down the pipe. |
| blackcell is offline | |
| | #8 |
| and the hat of vanishing Join Date: Aug 2001 Location: The edge of the known universe
Posts: 21,214
| So send a single byte of 0xFF. Or any character for that matter, since all that seems to be required is a sense of "now!", which can be just the arrival of the character.
__________________ If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut. Up to 8Mb PlusNet broadband from only £5.99 a month! |
| Salem is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| sending streams over serial port in win32 | deian | C Programming | 2 | 07-13-2009 12:01 PM |
| FTP program | jakemott | Linux Programming | 14 | 10-06-2008 01:58 PM |
| Serial port programming in Linux | g4j31a5 | C++ Programming | 1 | 09-28-2006 08:24 PM |
| Problem with string and serial port | collinm | C Programming | 2 | 03-23-2005 10:19 AM |
| Receiving characters on serial port | Roaring_Tiger | Networking/Device Communication | 3 | 07-01-2004 01:52 PM |