wow, thanks, that was quick:) For current code I jus added masking off first 4 bits of PICLSB after last shifting, instead of before shifting. Now it works correctly. On 5/21/07, Bob Barr wrote: > On Mon, 21 May 2007 19:27:51 +0300, KPL wrote: > > > >Here is part of the asm, for beginning I am reading only full degrees, > >so i take both data bytes, shift them 4 bits to leave integer only, > >and then decode and show it on old LED ascii display HDLU-1414. > >Program is based on routines from maxim application note 2420. > >May be somebody can see the error:) > > > > One possibility for a problem come to mind: > > Before doing those 4 'rlf' instructions on PICLSB, you should ensure > the the carry bit is cleared by using the pseudo-op 'clrc'. > > If the carry bit is set before those instructions are executed, bit 3 > of PICLSB will be set when you don't expect it to be. > > Regards, Bob > > > > > > rrf PICMSB,F > > rrf PICMSB,F > > rrf PICMSB,F > > rrf PICMSB,F ;shift 4 bits R > > movlw 15 ;mask for 4 bits > > andwf PICMSB,F ;leaving 4 bits > > andwf PICLSB,F ;leaving 4 bits > > rlf PICLSB,F > > rlf PICLSB,F > > rlf PICLSB,F > > rlf PICLSB,F ;shift 4 bits left > > movfw PICLSB > > xorwf PICMSB,W ;join both bytes > > > > movwf BIN > > call BIN2BCD > > > > bcf testout > > call hpdl_out > > call delay > >goto req_conv > > > > > > > >-- > >KPL > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- KPL -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist