I am trying to implement Dmitry's bit reversal algorithm under HiTech = PICC, but am having a problem with the variables. The function I have is: char reverse_bits(char source)// reverses bits 0 to 6 - source =3D = 0ABCDEFG { char result;=20 #asm swapf _source,w ;W=3D DEFG0ABC btfsc _source,3 ; If D =3D 1, xorlw 0x88 ;convert now sure W=3D 0EFGDABC btfsc _source,6 ;Test bit A xorlw 0x05 ;Invert bits A and C btfsc _source,4 ;Test bit C xorlw 0x05 ;Invert bits A and C ;now W =3D 0EFGDCBA btfsc _source,2 ;Do the same with E and G xorlw 0x50 btfsc _source,0 xorlw 0x50 movwf _result ;so now W =3D 0GFEDCBA (done) #endasm return(result); } But, on building, the linker says that _source and _result are undefined = variables. I thought that, to use a C variable in a piece of assembler = code, you simply prepend an underscore to it. Anyone know what I'm doing = wrong? Graham -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.