>> My question is: how can I modify my subroutine so that I can set which pin to oscillate. I want to be able to do something like: movlw 1; load w with number of pin on porta to pulse call ping; oscillate pin 1 movlw 2;now load in new pin number call ping ; oscillate pin 2. How can I do this? Are instructions like BCF porta,w valid? << No, the bit number in BCF and BSF are hard coded into the instruction, so you can't do it that way. You can set up a mask with the selected bit set to one, then OR with the mask to enable the bit and AND with the inverted mask to disable the bit. ******************************************************************** Olin Lathrop, embedded systems consultant in Littleton Massachusetts (978) 742-9014, olin@embedinc.com, http://www.embedinc.com -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.