piclist 2001\05\04\182112a >
Thread: a newbie mpasm question
www.piclist.com/techref/microchip/begin.htm?key=asm
flavicon
face BY : Michael Rigby-Jones email (remove spam text)



{Quote hidden}

That instruction is not valid, the bit must be set at compile time.
One way of doing this is to use a lookup table to convert your bit number to
a mask

e.g.

GetMask:
       addwf PCL,f
       retlw B'00000001'
       retlw B'00000010'
       retlw B'00000100'
       retlw B'00001000'
       retlw B'00010000'
       retlw B'00100000'
       retlw B'01000000'
       retlw B'10000000'


Then use the returned bit mask to toggle the port:

movlw 1                         ; select pin to toggle
call GetMask            ; retrieve the appropriate mask
xorwf PORTA,f           ; toggle the pin

Everytime you XOR the port with the mask, the select bit will toggle.

Hope this helps.

Mike

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


<0F60BEDDC090D41185D300508BCFA39EE81567@zpgty002.europe.nortel.com>

See also: www.piclist.com/techref/microchip/begin.htm?key=asm
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) a newbie mpasm question

month overview.

new search...