This is for a phase accumulator in a DDS -- the lookup table is 1024 entries, so the 24-bit accumulator needs to be truncated to 10-bits, or truncating 16 bits of the high and middle byte to 10 bits. The PIC in question is an 18F1320, and the table is aligned at 0x1C00. This means that TBLPTRH and TBLPTRL need to be updated for each read, with 0x1C added to the upper two bits of the 10-bit value for TBLPTRH, and the lower 8-bits of the 10-bit value copied to TBLPTRL. My first effort is below, but I think there must be a faster way to do it -- ACCLOOP movlw FRQL //frequency increment low byte addwf ACCM //increment accumulator low byte movlw FRQH // freq incr high byte addwfc ACCH //incr acc high byte movff ACCH, SHDH //shadow acc high byte rlncf SHDH rlncf SHDH, W //rotated twice, two highest bits of 10-bit value now two LSBs in W andlw b'00000011' //leaves just those two bits addlw 0x1C //add table offset movwf TBLPTRH //TBLPTRH ready rlncf ACCL, W rlncf W andlw b'00000011' movwf SHDL //upper two bits of ACCL, which will be lower two bits of 10-bit value readied in SHDL rlncf SHDH, W andlw b'11111100' //upper six bits (originally bits 5...0 of ACCH) addwf SHDL, W movwf TBLPTRL Would you guys know of standard/faster ways to do truncations to such odd bit values? Thanks, Ishaan -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu