Positron Compiler Documentation

Misc Declares.

Source: Positron8 Compiler User Manual, PDF page 420

Declare WatchDog = On or Off, or True or False, or 1, 0 With the Declare Watchdog set to one or true, the compiler will alter its default config fuses to enable the watchdog timer. But more importantly, it will add Clrwdt mnemonics to its library subroutines so the watchdog does not get triggered when any of the command subroutines are waiting. Especially the commands that require delays.

If the assembler code produced by the compiler is examined when the Declare Watchdog is set to one or true, a lot of Clrwdt mnemonics will be seen within its library subroutines. And where it would normally have a Nop mnemonic to delay a single clock cycle, it will have the Clrwdt mnemonic instead, and instead of a Bra $ + 1 or Bra $ + 2 or Goto $ + 1 mnemonic to delay 2 clock cycles, it will have Nop, Clrwdt instead for the 2 cycle delay, to make sure the watchdog is reset.

However, it does not add any Clrwdt mnemonics in the main user's code, except in low value DelayUs and all DelayCs commands that would normally use Nop, because they are created as inline delays. So a loop of any kind in the main program listing must clear the watchdog before entering it if the watchdog has been anabled, or clear it within the loop, if it does not use any high level compiler commands that clear the watchdog timer.

The compiler understands simple assembler mnemonics in the high level parser, so the Clrwdt mnemonc can be added as a BASIC command in your code. The default for the compiler's default config fuses is WatchDog Off.

Declare BootLoader = On or Off, or True or False, or 1, 0 The BootLoader Declare directive enables or disables the special settings that a serial bootloader requires at the start of code space. This directive is ignored if a PICmicro™ without bootloading capabilities is targeted.

Disabling the bootloader will free a few bytes from the code produced. This doesn't seem a great deal, however, these few bytes may be the difference between a working or non-working program. The default for the compiler is BootLoader On

Declare Warnings = On or Off, or True or False, or 1, 0 The Warnings Declare directive enables or disables the compiler's warning messages. This can have disastrous results if a warning is missed or ignored, so use this directive sparingly, and at your own peril.

The Warnings Declare can be issued multiple times within the BASIC code, enabling and disabling the warning messages at key points in the code as and when required.

Declare Hints = On or Off, or True or False, or 1, 0 The Hints Declare directive enables or disables the compiler's hint messages. The compiler issues a hint for a reason, so use this directive sparingly, and at your own peril.

The Hints Declare can be issued multiple times within the BASIC code, enabling and disabling the hint messages at key points in the code as and when required. Declare Float_Display_Type = Fast or Standard By default, the compiler uses a relatively small routine for converting floating point values to decimal, ready for Rsout, Print, HRsout etc. However, because of its size, it does not perform any rounding of the value first, and is only capable of converting relatively small values. i.e. approx 6 digits of accuracy. In order to produce a more accurate result, the compiler needs to use a larger routine. This is implemented by using the above Declare.

Using the Fast model for the above Declare will trigger the compiler into using the more accurate floating point to decimal routine. Note that even though the routine is larger than the standard converter, it actually operates much faster.

The compiler defaults to Standard if the Declare is not issued in the BASIC program.

Declare Create_Coff = On or Off, or True or False When the Create_Coff Declare is set to On, the compiler produces a cof file (Common Object File). This is used for simulating the BASIC code within the MPLAB™ IDE environment or the ISIS simulator.

Declare Signed_Right_Shifts = On or Off, or True or False In order to maintain backward compatability, Signed Right Shifts can be disabled, to match Positron8 compiler versions earlier than version 4.0.4.6. Setting the Declare to Off or False will disable signed right shifts if used with signed variables or within a signed expression, and this will match earlier compiler versions that did not have the ability of signed right shifts, while setting the Declare to On or True will enable signed right shifts.

From compiler version 4.0.4.6 onwards, the compiler defaults to signed right shifts enabled.