Is there a more efficient way to split nibbles (Code sample)

Status
Not open for further replies.
Here's how I'm doing it now, I have a byte in Temp_A and I want it nibble split across Port A 0-3 and Port B 4-7. Wondering if there is a better way to do this type of routine?

Code:
 setb  RP0   			;Bank 1
 mov  W,Temp_A
 and  W,#00001111b		;keep low nibble
 and  TRISA,W			;set I/O direction low nibble
 mov  W,Temp_A
 and  W,#11110000b		;keep high nibble
 and  TRISB,W			;set I/O direction high nibble
 clrb	RP0   			;Bank
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…