piclist 1997\06\30\170027a >
Thread: Commands for 16c54 ??
picon face BY : Steve Smith email (remove spam text)

You wrote
<IF w = f then , IF w<>f then , IF w > f then , IF w < f then>

I think this might work
firstly check if w=f by subtraction and checking Z and testing returning a 1
in the w register for the first result. secondly test for a carry (w>f)
(2)else the result is (w<f) (3) and by default w<>f and does not need

Call        Choice

SUBWF    f,w                ;subtract w from file
BTFSC     STATUS,Z     ; test for zero (w=f)
RETLW     1                  ; exit sub w=1 (w=f)
BCF         STATUS,C     ; clear carry before starting
SUBWF     f,w               ; do again and check for borrow
BTFSS     STATUS,C     ; test for carry (w>f)
RETLW     2                  ; exit sub w=2 (w<f)
RETLW     3                  ; exit sub w=3 (w>f) by default

minor fracture in the thaught process cant remember if Ive got the bit test
in the correct polarity but try it and see (Its close)...


See also: www.piclist.com/techref/microchip/devices.htm?key=16C
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) Commands for 16c54 ??

month overview.

new search...