Results 1 to 3 of 3
I am communicating with a protocol thats uses 1 start bit, 8 data bit, 1 address/data bit and 1 stop bit (No parity). The address/data bit is used to identify ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 04-30-2004 #1
- Join Date
- Mar 2004
How to detect the address bit (9 data bit)
I am communicating with a protocol thats uses 1 start bit, 8 data bit, 1 address/data bit and 1 stop bit (No parity). The address/data bit is used to identify the start of a frame In the first byte, in each frame the address/data is 1. The rest of the bytes in the frame is 0.
In the protocol specification, it says: "A great number of single chip micro processors from various manufactures are able to detect this address/data bit"
How/can I detect this address/data bit in Linux?
Linux dosnt support 9 data bit as standard. I have tryied pretending that the address/data bit is a parity bit instead. To make this work i would have to use Mark or Space parity. Im having a really hard time making space and mark parity work in my program. I know that Linux have implementet the command CMSPAR (termios.h), but it dosnt work very well with me.
It could really help if someone posted a code example, using space/mark parity. Also a list of what files and what there should be in them so I can use this parity.
I have to read AND write with the protocol.
Any help at all, is very welcome
FAQ: RedHat 9, C++, KDevelop, kernel: 2.4.20-31.9, Digi Neo serial card
- 04-30-2004 #2
- Join Date
- Apr 2004
im just usinga basic trick .. feel free to ignore if this is of no use.
If all you need to do is read the 9th or 10th bit, you could read a WORD from the stream(assuming you have a stream and use a MASK_WORD with the mask set as 0000000010000000, ie the bit you want to retrieve as 1. then perfrom a bitwise AND operation on your WORD && MASK_WORD. the result would be 0000000010000000 if the bit is set and 0 if it isnt. convert these values to hex(0x0 and 0x100 i suppose) and apply the comparison.
i know this isnt much.. but hope it helpsI\'m just a simple fisherman blessed with a lot of friends
- 04-30-2004 #3
- Join Date
- Oct 2001
- Täby, Sweden
The problem is that PC hardware has no port that uses such a protocol. You need to either design an external "adapter" (eg. using a PIC microcontroller) that converts that protocol into standard RS232, or use some bit-banging algorithm on eg. the parallell port. I would recommend the first method, since bit-banging needs to be carefully syncronized and takes quite a bit of CPU cycles. The advantage of the bit-banging approach is that you don't need to design any external hardware, of course.