PDA

View Full Version : DEBUG DEC DatVar vs DEBUG #DatVar



netstranger.nz
- 16th March 2011, 19:58
Hi Everyone

I've just discovered that when you send decimal variable over the serial line you can use two different qualifiers DEC or #.
DEBUG DEC DatVar and DEBUG #DatVar will produce the same result in the Serial Communicator(F4 if you use Microcode Studio). I've noted though that DEC uses 27 words of the code space more than #. The timing doesn't change. http://www.picbasic.co.uk/forum/images/editor/attach.png
SEROUT also uses more code space than DEBUG while producing the same result according to the PICBasicpro manual.
Regards

HenrikOlsson
- 16th March 2011, 21:26
Hi,
With the DEC modifier you can specify the number of digits to send and even "print" signed number with SDEC - neither of which you can do with the #-modifier. That extra power/feature comes at a cost.

DEBUG is "leaner" because its parameters (pin, baudrate and mode) are set at buildtime (by the DEFINEs). This means that the timing is calculated at build time and programmed as constants. When you use SEROUT you can change it and runtime which means that the timings needs to be calculated at runtime, at a cost. SEROUT also supports more modes (open vs driven) than DEBUG does.

If DEBUG and # provides you with what you need there's absoultely no reason not to use it.

/Henrik.