Hmm...maybe I should actually *read* stuff a bit more thoroughly before diving in with both feet.... I kinda missed the bit about the bit positions you were using, I assumed you were reading bits 1 -4 for the port. Yep, total b*ll*cks I'm afraid, my only defence being that I got up at 5:30 this morning. Having looked at your code properly now (i.e after 4 cups of coffee) the problem seems to be that you can't do bit sets or clears on W, it isn't addressable as a normal file register. You'll have to do the bit operation on a defined variable and copy it back to W. Sorry about that! Regards Mike Rigby-Jones mrjones@nortelnetworks.com > > > (assume SWITCH has been equated to a spare ram address) > > > > > > movf GPIO,w ; get switch valuesI'll try to follow > you on this... > W = 00DC0BA0 > > > movwf SWITCH ; store in ram locationSWITCH = 00DC0BA0 > > > rlf SWITCH,f ; rotate left to put in bits 0 - 3SWITCH > = 0DC0BA0x where x = CARRY > > movlw 0xf0 ; clear top nibble (may not need this)W > = 11110000 > > andwf SWITCH,f ;SWITCH = 0DC00000 > > > swapf SWITCH,w ; swap upper and lower nibbles and put > back in wW = 00000DC0 > Hmmmm, I need W = DCBA0000 > > Did I miss something? I have been up all night and it is now 5:20AM so > anything is > possible. > > Does my BSF idea have any holes that you see? > > Thanks for the reply. > > Michael > > * TAKE THE '.NOSPAM' OUT OF MY ADDRESS TO REPLY > ********************************************** > Outside of a dog, a book is man's best friend. > Inside of a dog, it's too hard to read anyway! > Groucho Marx > ********************************************** >