> Thanks Bob, > = > I was hoping that was how it worked, but was starting to wonder. > = > It's funny, I feel like I have a reasonable understanding of how a Pic wo= rks ... > but when I go to do something specific (that I haven't done before) ... = all > these other doubts pop up. > = > No substitute for experience I guess. > = > Anyway, at least my program should have some hope of running now that you = > guys have sorted me out on my main concerns. > = > Thanks, Roger You can actually use the simulator that is included in MPLAB to singlestep = through your code. This is a very useful learning experience. When in doubt= , I = usually go through the suspicious code with the simulator and with all poss= ible = variations in the input data to check that it always work as expected. Even though I have used the PIC micros for more than 15 years now, I still = find = new ways of doing things. The last one was SUBLW 0, which does a one = instruction 2-complement negation of w. Here is a couple of other not so obvious examples of how things can be done = differently and more efficiently on the midrange PIC, even though it only h= as = 30-something instructions: btfss reg,bit goto end_test btfss another_reg,another_bit = goto end_test do_work: which can be rewritten as: btfsc reg,bit btfss another_reg,another_bit goto end_test do_work: Yet another one: movlw 1 xorwf reg,w btfss status,z goto test_case_15 ... ;do work for case 1 goto end_work test_case_15 movlw 15 xorwf reg,w btfss status,z goto test_case_28 ... ;do work for case 15 goto end_work test_case_28 movlw 28 xorwf reg,w btfss status,z goto end_work ... ;do work for case 28 end_work which can be rewritten as: movf reg,w xorlw 1 btfss status,z goto test_case_15 ... ;do work for case 1 test_case_15 xorlw 1^15 btfss status,z goto test_case_28 ... ;do work for case 15 test_case_28 xorlw 15^28 btfss status,z goto end_work ... ;do work for case 28 end_work /Ruben =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D Ruben J=F6nsson AB Liros Electronic Box 9124, 200 39 Malm=F6, Sweden TEL INT +46 40142078 FAX INT +46 40947388 ruben@pp.sbbs.se =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist