Try this: #define mask(bit) (1< To: Sent: Wednesday, February 14, 2001 8:31 AM Subject: Re: [PIC] Easy way to convert # to bit position? > >> I'm pretty sure this is a stupid question, but is > >> there an easy way to convert a number into it's > >> appropriate bit position? > > > Not sure what the FAQ says but you can do it this way: > > #define SET_BIT(n) (unsigned char)(1L<<(n)) > > I've also been keeping an eye for a similar solution to the original poster > of this question. There are two problems I have with this particular > solution (in my situation). 1) This solution is C compiler based, and I do > all my SX/PIC stuff in ASM. 2) This solution is compile time dependent, and > does not provide a runtime solution. Even though this solution doesn't work > for me, thanks for the suggestion. > > -- Mitch > > -- > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body > > -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body