redhat
Advanced Member level 4
in microchip app note
https://ww1.microchip.com/downloads/en/AppNotes/6_005.pdf
does anyone know why they didn't put the shifted bit (LSB) in the high_byte into the MSB in the low_byte ?
as they should,or is there any other better code
thanks in advance
GEN_PRBS
bcf HIGH_BYTE,7 ; set shift-in value to 0
rrf HIGH_BYTE,1 ; shift high byte right
rrf LOW_BYTE,1 ; shift low byte right, shift out bit is carry bit in status
movfw STATUS ; load status register
andlw 0x01 ; isolate carry bit
movfw GPIO ; output new prbs value
GEN_SHIFT_IN
xorwf LOW_BYTE,0 ; determine value to shift into high bit of register
andlw 0x01 ; isolate shift-in value, sets zero flag if zero
btfss STATUS,Z ; if shift-in bit is zero, skip the following instruction
bsf HIGH_BYTE,6 ; set high bit to 1
goto GEN_PRBS
https://ww1.microchip.com/downloads/en/AppNotes/6_005.pdf
does anyone know why they didn't put the shifted bit (LSB) in the high_byte into the MSB in the low_byte ?
as they should,or is there any other better code
thanks in advance
GEN_PRBS
bcf HIGH_BYTE,7 ; set shift-in value to 0
rrf HIGH_BYTE,1 ; shift high byte right
rrf LOW_BYTE,1 ; shift low byte right, shift out bit is carry bit in status
movfw STATUS ; load status register
andlw 0x01 ; isolate carry bit
movfw GPIO ; output new prbs value
GEN_SHIFT_IN
xorwf LOW_BYTE,0 ; determine value to shift into high bit of register
andlw 0x01 ; isolate shift-in value, sets zero flag if zero
btfss STATUS,Z ; if shift-in bit is zero, skip the following instruction
bsf HIGH_BYTE,6 ; set high bit to 1
goto GEN_PRBS