Kevin Olalde wrote: > If anyone is interested in an ugly, fat, second pic project, > manchester decode routine: > > decode > ; data starts off stored in temp (rxreg is also used) > movlw 0x00 ; start with all 0 > movwf rxreg ; temp space for holding output > bcf STATUS, C ; make sure carry is cleared > btfsc temp, 7 ; check bit > bsf STATUS, C ; if set, shift 1 into dest byte > rlf rxreg, F > bcf STATUS, C ; make sure carry is cleared > btfsc temp, 5 > bsf STATUS, C > rlf rxreg, F > bcf STATUS, C ; make sure carry is cleared > btfsc temp,3 > bsf STATUS, C > rlf rxreg, F > bcf STATUS, C ; make sure carry is cleared > btfsc temp,1 > bsf STATUS, C > rlf rxreg, W ; store in W for last bit > > return Kevin: Your code isn't really a Manchester decoder, of course; it just copies bits 1, 3, 5, and 7 of temp to bits 0, 1, 2, and 3 of the W- register. Here's another method that's shorter, faster,and doesn't need the RXREG temporary register: RRF TEMP,W ;Copy TEMP bit 1 to W bit 0, and ANDLW 0x01 ;clear all other bits of W. BTFSC TEMP,3 ;Copy TEMP bit 3 to W bit 1. IORLW 0x02 ; BTFSC TEMP,5 ;Copy TEMP bit 5 to W bit 2. IORLW 0x04 ; BTFSC TEMP,7 ;Copy TEMP bit 7 to W bit 3. IORLW 0x08 ; RETURN === Andrew Warren -- aiw@cypress.com === Principal Design Engineer === Cypress Semiconductor Corporation === === Opinions expressed above do not === necessarily represent those of === Cypress Semiconductor Corporation -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu