Hello,
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.
Hello,
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.
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.
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
Note /dev/ttyS0 in linux is where your serial port is locatedCode: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
Hope it helpsare 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"].
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? )
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
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.
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.
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.
If at first you don't succeed, try writing your phone number on the exam paper.