Hi all, Once again...back at my C project after a few weeks away. This time I'm trying to streamline bit testing. I know there isn't a direct equivalent to BTFSC in C, so I'm following some advice from the XC manual, section 3.4.4.2 "How can I access individual bits of a variable". It proposes creating a bit testing define like this: #define testbit(var, bit) ((var) & (1 <<(bit))) I am using this code in the following way: if(!(testbit(this_led, 23))) { // test fixed bit 23 SSP2BUF =3D ws2811_one; } else { SSP2BUF =3D ws2811_zero; } What I am doing is testing the individual bits of a variable, then using the result to decide what to send out via SPI (not relevant at this point, but I am trying to control WS2812 LEDS). I am always testing bit 23, then shifting the variable to the left to get at the next value. My issue is that my testbit always ends up returning 0. With the "!", that means my code is always transmitting a 1. If I remove the "!", I am always transmitting a 0. My thought is that perhaps this is happening because of the bit I am testing? The temp variable testbit is declared like this: "static uint32_t this_led;", so it is actually a large enough variable to be testing bit 23. I had a look at the listing output of the compiler, and I found this: 852 ;ws2812_lib.c: 37: if((((this_led) & (1 <<(23= ))))) 853 000548 A03E btfss send_frame@this_led,0,c 854 00054A D002 goto l1127 To me, it looks like the assembly code is testing bit 0. This would make sense in that the assembly code doesn't natively support 32 bit variables. If my guesses are correct, what might be a better way to deal with this? I would prefer to avoid testing bit 0 and shifting the other way due to the order in which I need to send the bits. Thoughts? Thank you! Josh --=20 A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. -Douglas Adams --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .