On Thu, 1 May 2014, Larry Bradley wrote: > Can anyone point me to some examples of in-line assembly code for the > XC16 compiler (I'm using a PIC24H ...). The Microchip docs don't tell me > much, and I've Googled until my fingers are sore! > > What I'm trying to do is make up for the fact the C doesn't give you > access to the bits of a byte. To determine if a bit is set, one has to > use a mask, as in > > if (mybyte & 0b00100000) { } > > This generates a lot messier code than if one could just test a bit > directly using BTST, for example. > Hi Larry, Have you actually checked what the compiler produces in that case? Some=20 compilers will actually optimise that to a bit test (don't know about XC16). You might need to change your code slightly to help the compiler. You=20 might try something like: if ((mybyte & 0b00100000) !=3D 0) { } Regards Sergio Masci --=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 .