Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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.

Latest threads

New Articles From Microcontroller Tips

Back
Top