开发者

API/OS support for "9-bit" serial communication

开发者 https://www.devze.com 2022-12-14 00:14 出处:网络
Does java\'s javax.comm library support \"9-bit\" serial communication? (use of parity bit or \"address开发者_StackOverflow社区 bit\" as an out-of-band signaling mechanism for framing information)

Does java's javax.comm library support "9-bit" serial communication? (use of parity bit or "address开发者_StackOverflow社区 bit" as an out-of-band signaling mechanism for framing information)

Does the win32 communications API support it?

I'm guessing the answer is no on both counts, but figured someone has more experience with this than me.


The win32 comm API does not support this as far as I can tell.

However, you can simulate it using the various parity modes.

Setting MARKPARITY will set the 9th bit to 1

Setting SPACEPARITY will set the 9th bit to 0

I can't say about the java version of the library, but I'm sure it supports setting parity modes so you can do the above and get your 9th bit.


Yout should follow this Seeking FOSS serial port component which can handle 9 data bits.
Your main problem will be to handle 9-bit at all, as when the windows api can't handle it, how should java solve this?

Bt there exists professional cards/driver to solve this (see the link)


I'd like to comment on karoberts answer, but I lack reputation. So I have to "answer".

karoberts proposes a good way if we need a software solution to our problem (JCS citation, almost, isn't it? ))

But there may arouse a situation I faced today with Python (2.7) trying to do exactly the same thing: my PC refused to accept PARITY_MARK and PARITY_SPACE as options to configure my /dev/ttyS5. So I searched in Stack Overflow what can be done - and encountered this topic...

And I've found an answer in that (closed) question, jeb tells us in the next answer. Tincho points to an article where it's proposed to set EVEN or ODD parity with each byte according to 2 factors: whether this is an address byte and what is the parity sum of it's bits. I checked the solution and it works perfectly.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号