Zone compare range check small demo program...
OzStamp
Posts: 377
Hi Fellow Proppers..
Customer support for a local here in OZ.
Wanted a simple but fast range compare .. if value is between 2 values..output on..
Attache a quick knock up..in asm.
See file attached.
Dare to share if you can do it better..or if you have any suggestions .. please fire away.
Cheers· Ron Mel OZ
Customer support for a local here in OZ.
Wanted a simple but fast range compare .. if value is between 2 values..output on..
Attache a quick knock up..in asm.
See file attached.
Dare to share if you can do it better..or if you have any suggestions .. please fire away.
Cheers· Ron Mel OZ
Comments
Cheers,
Shane. (Perth WA)
But... well done, Ron! The very first result from an unexperienced machine code programmer But it works!
If this is what you took from my tutorial I am really proud of you - but now comes the second level...
I inserted comments with some hints for improvement:
Post Edited (deSilva) : 2/25/2008 4:57:51 AM GMT
Thanks for the pointers..
I can get most things happening in asm but it takes some effort.
Spent the last 30 years of my life programming PLC's so the logic part of it is easy
just getting used to all the instructions is the biggest issue with me..
Thats why I try and disect snippets /blocks of code to see what happens..
I will type your code in and disect .. do you ever sleep ?.. it must be early morning now..
It is school/uni holiday time at the moment ??
The value by the way can be and will be totally variable so the shift method you indicated
may well work for certain value's but probably won't satisfy it totally...
The values are most likey in the 1000-4000 range (high speed A/D chip read/compare)
Anyway as alway's thnks for the pointers and take care.
Ron Mel Oz
Edit: And yes! It was!! And a very common mistake!! See NO/YES below!
Post Edited (deSilva) : 2/25/2008 2:55:38 PM GMT
Then your program had been faulty!
You should understand that my shifting did not change anything within your logic! It has just made it cleaner!
Maybe we'll have to start our own forum
Sorry (to the rest of the world)... off topic and only (possibly) of interest to four of us here!
Cheers,
Shane.
This is very cool idea. MUX is generally not a necessary instruction,
as you can always replace it by something as the above two instructions, but it will
shorten the program!!!
Edit: deSilva is still blushing...
The OR must be with #|<firstOutputPin or course
But everything will be mended by the MUX!!
As an exercise, here is a use of MUX to simulate a SaveFlags and a RestoreFlags operation,
which do not exist on the Prop
Post Edited (deSilva) : 2/25/2008 3:30:04 PM GMT
Post Edited (deSilva) : 2/25/2008 3:33:33 PM GMT
but... we wouldn't have seen the other bit of code about saving the z and c flags
Steve I make five, but currently in Pula Penang Malaysia ATM, been here two years and will for another year at this stage.
Dont ask for any help though... I'm just starting out [noparse]:)[/noparse]
Sevs
Perth(WA)