Hello
For my SPI communication, I need send a 16 bit data.
Then I write 16 bit variable to spiaRegs.TXBUF:
MyUINT16Var= 0x1234;
spiaRegs.TXBUF = MyUINT16Var;
by this way, SPI send data with following bit flow: Fisrt transmitted bit: 0, second: 0, ... 0 1 0 0 1 0 0 0 1 1 0 1 0 0 .
Then the transmitted data are MSB first : 0x1234.
For My end device, I need following flow : 0 0 1 1 0 1 0 0 0 0 0 1 0 0 1 0 => 0x3412.
To resume, I need before transmit swap MSB and LSB of my 16 bits variable.
I seen compiler instruction : __flip16(MyVar) (in www.ti.com/lit/ug/spru514j/spru514j.pdf)
, but the result is 0x2C48 because is the bit was reverse. I need to reverse the Byte. : 0x12 34 become 0x34 12.
I seen in http://www.ti.com/lit/ug/spruhs1a/spruhs1a.pdf the assembler instruction
VBITFLIP VRa — Bit Flip which seem correspond to compiler __flip16(MyVar)
I also seen :
VCFLIP VRa Swap Upper and Lower Half of VCU Register
This instruction seem ok for me.
But I not found the correspondance in C compiler. The I try asm("VCFLIP VR0;");
Are they compiler instruction like _flip16 which allow to swap 8 LSB bit with 8MSB bit of a variable?