Hello, I have a variable of type Nat16 (unsigned int) which is called PulseWidth. In the function that fills the variable PulseWidth, there's some assembler code (#pragma asm/endasm included in the .c file), so I have to indicate to the compiler to generate an assembler src file and to assemble this src file too. Because of that, I have to open the corresponding .src file to put breakpoints (apparently, I can't put breakpoints in the 'normal' .c file). When the breakpoint is hit, I would like to see the content of this variable in the watch window #1. However, I only see the value of one byte of this variable iso the whole variable. I have to open the memory window after looking where in the memory this variable is located, and only then I can see the two bytes (so, the 'complete' variable). My question: how to show the complete variable when you have hit a breakpoint in a .src file? Is there something like PulseWidth and PulseWidth+1 to be defined in the watch window? The example I gave just now certainly does not work, because if you put PulseWidth+1, the watch window simply adds 1 to the value of PulseWidth. Is there some other way to represent the second byte (or better, the whole variable at once)? Rgds, --Geert PS.: uVision version 2.33, C-compiler version 7.03.
The problem is in the way C51 does inline assembler. To use inline assembler, you have to specify the SRC directive. This means that the C51 Compiler does not generate any object file; since it doesn't generate an object file, it can't put any debug information into it. The object file is, instead, generated by the Assembler; so the only debug information you get is Assembler debug info. The Assembler doesn't know anything about 'C' ints, longs or anything else; all it knows about your PulseWidth symbol is that it's the address of a byte - all the work to do with 16 (or more) bit arithmetic is generated by the compiler using offets from that byte As has already been said: if you want to debug in 'C', you'll have to write in 'C'; If you want to write in Assembler, then you'll have to be prepared to debug in assembler! Have you looked at the DEFINE debugger command? Perhaps you could put some DEFINEs into an initialisation file so that the debugger knows what size you want your variables?