This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

accessing bitwise data in a data buffer

hi all,
iam a new to embedded programming and keil software.
i am struck with a problem how to access a bit in a data buffer.

the algo i need to implement is

data_buf of 32 bits is stored in the micro controller. i need to send those bits bit by bit. ie. starting from bit 0 to bit 31.

can anybody pls suggest me how to write a program in keil.

thanks in advance
uday

Parents
  • "I was considering a generic function which can send a byte."

    Even more reason to keep it simple:

    for( i=0; i<8; i++ )
    {
       DATAPIN = byteToSend & 1;
       byteToSend >>= 1;
    }
    If you were actually writing a generic fucntion, I think a pointer & size would be easiest.

    Or a hardware shift-register... ;-)

Reply
  • "I was considering a generic function which can send a byte."

    Even more reason to keep it simple:

    for( i=0; i<8; i++ )
    {
       DATAPIN = byteToSend & 1;
       byteToSend >>= 1;
    }
    If you were actually writing a generic fucntion, I think a pointer & size would be easiest.

    Or a hardware shift-register... ;-)

Children
No data