[quote user="Jerry Bucci"] Line Code 95 B8_1(&P8OUT)=0; 96 B8_1(&P8OUT)=1; 97 B8_1(&P8OUT)=0; 98 B8_1(&P9OUT)=0; 99 B8_1(&P9OUT)=1; 100 B8_1(&P9OUT)=0; When i compile and run to line 95 then single step, it seems to execute line 95, then jumps to line 98, then jumps over to line 101. The disassembly is below. When I look at the registers P8OUT and P9OUT neither changes from FF. Possibly the Bit.def.h shown in the beginning of this post is incorrect?? Please Help. Thanks 0114b2: C3A2 003B BIC.W #2,&Port_7_8_P8OUT 98 B8_1(&P9OUT)=0; 0114b6: D3A2 000A BIS.W #2,&Port_9_10_P9OUT [/quote] Compiler sees that you are taking a memory location, changing it to 0, then changing it to 1, then changing it to 0. End result, just changing to a 0. Compiler optimizes your code to just the one instruction. According to the rules of the compiler, it can do this because it doesn't know that there is anything special about this memory location. You need to modify your port macros to include the "volatile" keyword. This will force the compiler to generate code for all the bit changes, not just the end result.
↧