pseudo random noise generator

Status
Not open for further replies.

redhat

Advanced Member level 4
Joined
Aug 1, 2004
Messages
116
Helped
2
Reputation
4
Reaction score
0
Trophy points
1,296
Location
Egypt
Activity points
979
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
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…