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.

desperate for help

Status
Not open for further replies.

kutalinelucas

New Member
i'm trying to compaire a value stored in w to a number of values stored in general purpose registers in a loop, could anybody pleasse help?
 
if you look at the i'm stumped' thread below it should be explained, but its basically a 6 bit imnput i need to compaire to 31 possibilities, and when a match is found it exists the loop. im using pbasic and basically if i cant figure out how to do this small bit of my project in the next hour im gunna bugger up my degree. so im really desperate and i dont know what to do.

the task is alot simpler than it seems below, i literally just need to compaire 2 values, if they are equal goto a routine, if not carry on till the end of the loop
 
You can compare with basic logic functions.You can xor the two values or you can substract the value & can make decision according to your status bit.

Code:
check1	movf	Value,W		;get the new value
	xorwf	FixValue,W	;xor with the fix value
	btfss	STATUS,Z	;has the zero bit set?
	retlw	00		;no,then return
	movf	Value,W		;yes,both are equal then return with W
	return
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top