Software Method1: unsigned char Swap( unsigned char m ) { unsigned char i; unsigned char n; for ( i=0; i<8; i++ ) { n <<= 1; if ( m & 0x01 ) { n += 1; } m >>= 1; } return n; } Method2: ( h8 Assembly ) .....logicall shift ,carry bit and..... Method3: ( hardware ) Program a GAL (16v8) ......( 8 DFFs and cross 8 output with OE ) and use one port to write and read back the one byte data. so ... define SwapPort 0xxxxxxxx; (unsigned char*)( SwapPort ) = m; m_swaped = (unsigned char*)( SwapPort ) ; that's all. thank you for your time. ----- Original Message ----- From: <tsuchida.seiji@xxxxxxxxxxx> To: <h8@xxxxxxx> Sent: Friday, January 17, 2003 2:00 PM Subject: [H8-ML(2695)] ■8bitデータのMSBとLSBを逆転させるには? > > つちだです。 > 8bitデータのMSBとLSBを簡単に逆転させるにはどうしてますか? > 例えば、 > 0x13(0001 0011) > なら > 0XC0(1100 1000) > にする。 > > やっぱ 1ビットづつやらないといけないのでしょうか? > > みなさんの手法、ソースコードをご伝授ください! > >