Michael, Bingo!!! I checked and sure enough PrintHex uses a register in bank0. And since we were in bank1, it lost it's mind. We changed the PrintHex routine to always return to bank0, and now it works like we wanted it to and not like we told it to. Thanks Michael for the pointer to the right direction. And thanks to all who responded. I hope the PICLIST goes on forever. What a think tank. Regards, Jim P.S. Michael, aren't you located somewhere around Spring or Conroe or something? I'm in Stafford. > It seems odd to me that you'd switch to Bank1 and then call a >subroutine. Does the PrintHex routine assume that it's pointing to >Bank1 upon entry? What about RP1, is it always 0? > > michael brown > > > >> All, >> >> A question about the 10 bit AD on an F877. Referring to the code >snippet >> below, looking at the line indicated ( by **--->), can anyone explain > why >> when this reads 'bsf STATUS,RP0', the program hangs apparently at > that >> line. If we change it to read 'bcf STATUS,RP0', the program don't > hang, >> but we still can't get the 2 bits of the LSB. We've tried adding a > wait >> before changing banks, we've tried changing the justification of the >> result, we've tried changing the order in which we read the result, > we've >> cussed at it, etc., etc., but nothing has helped. I tried calling > MCHIP, >> but the phone message says they can't answer the phone at this time, >so I >> just left a message. But I need an answer ASAP. I prefer not to > wait >> until next week when they get back to me, if then. If you have any >> further questions, email me. >> >> Does anyone have any ideas to try that I haven't mentioned? If so, > any >> and all are welcome. Please advise. >> >> >> Thanks and Regards, >> >> jim >> >> >> >> >> >> >> >> >> >> >> RdVrp ; read ASIC pos ref voltage >> errorlevel -302 >> bcf STATUS, RP0 ;bank 0 >> bcf STATUS, RP1 >> movlw B'01001001' ;Fosc/8, A/D chan 1, A/D > on >> movwf ADCON0 >> bsf ADCON0, GO >> >> movlw D'1' >> call Wait >> >> >> VrpWait >> btfsc ADCON0, GO >> goto VrpWait >> >> bcf STATUS, RP0 >> movf ADRESH, W >> movwf AccaH >> >> ; movlw D'2' ; wait 2ms >> ; call Wait >> ; bcf PIR1, 6 ; clear int flag >> >> >> >> **---> bsf STATUS,RP0 ; goto page 1 >> >> >> >> ; movf ADRESL, W >> ; movwf AccaL >> call PrintHex >> return >> >> -- >> http://www.piclist.com hint: PICList Posts must start with ONE topic: >> [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads