/*
   Copyright (c) 2015, Digi International Inc.

   Permission to use, copy, modify, and/or distribute this software for any
   purpose with or without fee is hereby granted, provided that the above
   copyright notice and this permission notice appear in all copies.

   THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
   WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
   MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
   ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*****************************************************

GENERATE_WDTOs.C

This program generates watchdog timeouts that
can be displayed with DISPLAY_ERRORLOG.C.

1) Make sure ENABLE_ERROR_LOGGING at the top of the
   ERRLOGCONFIG.LIB is #defined to 1.

2) Compile this program to flash.

3) Disconnect the programming cable from the target

4) Cycle power on the board or hit the reset button if
   it has one.

5) Wait a moment, then reconnect the programming cable.

6) Compile DISPLAY_ERRORLOG.C and run it to see the
   count of watchdog timeouts
******************************************************/
#class auto

void main() {
	;

#asm
	ipset 3          ; disable interrupts so that the
	                 ; periodic ISR doesn't hit the
	                 ; watchdog.

	ld a,0x53		  ; set the WD timeout period to 250 ms
	ioi ld (WDTCR),a
#endasm

   while(1);        // now loop.
}