In SX Microcontrollers, SX/B Compiler and SX-Key Tool, dkemppai wrote: [quote="Peter Verkaik"] If the bitposition is known, mov w,#1<<bitpos xor targetvar,w This is assumed the bank is already set, or targetvar is global, as ports are. regards peter [/quote]I didn't think of xoring... ...I'll have to remember that. (Although, I do use XOR gates to buffer/invert data streams via logic control...) The problem is that the pin/bit is an assigned name variable, and may move depending on where I use this code. For example: MyPin equ RA.1 in one example... MyPin equ RE.3 the next time I use it. I good example would be a macro called "FlipBit", where I call the macro, and pass "MyPin" to the macro... Is there any way to determine the bit position of a bit in a variable in the macro language? Thanks! Dan P.S. I'm really starting to like macros... :) ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=364760#m364849 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)