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?
 
What language do you use?

Do you need to compare one value at one time or do you need to compare one fixed value with a lot of values in a table.
 
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.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…