Truncated match.
PICList
Thread
'Limiting number range'
1998\01\19@192359
by
Mike
Hi,
I need to ensure a number (read from EEProm) is with certain limits (0..10
decimal) and if
outside those limits set the number to 1.
This works, but is there a quicker, better, or more obscure way of acieving
the same effect?
movf Number, w
sublw .10
skpnc
goto TestEnd
movlw .1
movwf Number
TestEnd
Regards,
Michael
1998\01\19@200438
by
Andrew Warren
Mike <spam_OUTPICLISTTakeThisOuT
MITVMA.MIT.EDU> wrote:
> I need to ensure a number (read from EEProm) is with certain limits
> (0..10 decimal) and if outside those limits set the number to 1.
>
> This works, but is there a quicker, better, or more obscure way of
> acieving the same effect?
>
> movf Number, w
> sublw .10
> skpnc
> goto TestEnd
> movlw .1
> movwf Number
> TestEnd
Michael:
This way is a LITTLE quicker and shorter, and it'll work on the
12-bit PICs as well as the 14-bit ones:
MOVLW 10+1
SUBWF NUMBER,W
MOVLW 1
SKPNC
MOVWF NUMBER
-Andy
=== Andrew Warren - .....fastfwdKILLspam
@spam@ix.netcom.com
=== Fast Forward Engineering - Vista, California
=== http://www.geocities.com/SiliconValley/2499
More... (looser matching)
- Last day of these posts
- In 1998
, 1999 only
- Today
- New search...