> I have three pins (say RB0, RB1 and RB2) that all receive the exact > same format of serial data at different times. I want to use one section of > code to receive data on any one pin at a time. Since I have to use BTFSx > instructions to sample the pin, how can I make the code change which pin its > reading? I can already determine which pin I need to be reading at any > given time, but I just don't see how to transfer that information in a > usable way. I have had it working up till now by copying the code three > times and changing the literal in the BTFSx instruction, but now I am > starting to run low on code space and want to shrink the amount of code. There are so many ways to do this, you will probably get many different suggestions. One way would be to have a subroutine that does all the processing for a bit. You pass it a mask for the port B bit it is supposed to work on. The subroutine ANDs the mask and the port B value to determine whether the bit is 1 or 0. ******************************************************************** Olin Lathrop, embedded systems consultant in Littleton Massachusetts (978) 742-9014, olin@embedinc.com, http://www.embedinc.com -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads