send and recive binary bit stream

helo…
for my final year project i want to generate some binary bit stream with 12 bits (eg:- 0111 1010 0011)
from one arduino and recevie the binary data through another arduino and store into variable… any possibilites doing this ?
we are trying to do a poweline communication project. from the trasmitter i need to send 12 bit stream which contains information about reciver side 3 equipments. In 12 bit sream it is like a protocol, from 1st 4 bits it indicates the starting of the process process and 2nd 4bits is for address of quipments, and last 4 bit is for weather on/off of the selected equipment. (something like state machine)

any idea how to generate 0111 1010 0011 and read it using another arduino??
what are the suitabe built in functions for generating and receving binary bit stream?(sorry my kniwldge on funtions are v. low) i don/t want to send as strings or whole decimal number… only binary bit stream

Yes. Start with a Google search and then, if you're having problems, properly post your code here and we'll see if we can help.

Yes, take a look at Robin2's thread on Serial Basics. Sorry, but I don't have the link to it right now, so you'll just have to search the forum for the thread.

What exactly are you planning to do with the project?

i was serching for this from last week. i couldn't find what is suitable for my work
we are trying to do a poweline communication project. from the trasmitter i need to send 12 bit stream which contains information about reciver side 3 equipments. In 12 bit sream it is like a protocol, from 1st 4 bits it indicates the starting of the process process and 2nd 4bits is for address of quipments, and last 4 bit is for weather on/off of the selected equipment. (something like state machine)

any idea how to generate 0111 1010 0011 and read it using another arduino??
what are the sitable functions for generating and receving binary bit stream? i don/t want to send strings.. only binary bit stream

Pad it up to a whole number of bytes then send it as an array or structure. The receiving end can parse it out to bit meaning.

Are you saying you need to send a twelve bit frame?

yes 12 bit frame.. and also recive it from another arduino

Any stream is binary (OK, there is also trinary).

Your example shows 12 'things'. And will probably translate to (got tired after the first two blocks)

b00110000 b00110001 b00110001 b00110001 b00110001 b00110000 b00110001 b00110000 b00110001 .....

Anyways, be very clear in what you call a binary bit stream and what 12 means (bits or bytes).

// Edit: OK, I see that you mean 12 bits.

Best is to define a protocol. It will usually contain a start byte, a length indication, the actual data, a checksum or crc and an end byte. The length might be obsolete in this case.

could you plz givve me help with how to start??

Use an unsigned int and manipulate the bits there. Or use 2 bytes. 4 bits will be unused. Send the 2 bytes over.
Example with bytes:

byte0 = 0x0F | processBits; // bits 3-2-1-0 are now the process bits
byte1 = ( 0x0F | addressBits ) << 4; // bits 7-6-5-4 are now the address bits
stateBits = 0; // clear out current state
stateBits = stateBits | bit0; // bit0 = 0 or 1
stateBits = stateBits | (bit1<<1); bit1 = 0 or 1
stateBits = stateBits | (bit2<<2); bit2 = 0 or 1
stateBits = stateBits | (bit3<<3); bit3 = 0 or 1
// stateBits now = to 0-0-0-0-bit3-bit2-bit1-bit0
byte1 = byte 1 | stateBits; // 7-6-5-4 are address bits, 3-2-1-0 are state bits

Link to Serial Input Basics but it may not be very useful in this case as the examples assume there are at least two byte values that can never occur in the data.

Using start and end markers is a little more tricky if the data can contain any byte value from 0 to 255. If you can afford to exclude two values from that range it makes life very much simpler - for exmple treat 253 as the max value and leave 254 and 255 for markers.

This Python Binary Data demo may be more relevant.

...R

Google "serial bit-banging", though twelve bits is a tad too long for my liking.

we are trying to do a powerline communication project.

Can you explain a bit more?

cattledog:
Can you explain a bit more?

I am assuming they want to use powerlines to send data. I guess its possible at high frequencies...I dunno.

As far as the OP's original question, what you are doing is pretty easy.
Look these terms up:

  1. Interrupts on Arduino.
  2. Bit Shifting on Arduino
  3. time without delay()
  4. Port Manipulation.

Come back in a week after reading and trying.