Trigger Out Example

Last modified by Microchip on 2023/12/20 21:11

A handy feature of the trigger out signal is that its duration can last as long as the occurring event. For example, if the customer needs to time the duration of the watchdog timer (whose timeout period is user-programmable); the following code, in conjunction with the trigger out and SLEEP event breakpoint features, can make timing an event very simple without employing the old-school technique of writing a single line of (special, non-production) code to wiggle an I/O pin.

The following code is an example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
    ; -----------------------------------------------------
    ;   T R I G G E R   O U T   T E S T :
    ;   T I M I N G   T H E   W A T C H D O G   T I M E R
    ; -----------------------------------------------------
 
    ; 1) Ensure the watchdog timer configuration bit is enabled.
    ; 2) Set an Event Breakpoint (Break on SLEEP) to initiate a
    ;    'Trigger out' action only.
    ; 3) Connect your oscilloscope probe to the TRIGGER OUT pin and
    ;    set up your oscilloscope to trigger on the rising edge.
    ; 4) Run the following code:
 
    CLRWDT
    NOP
    NOP
    SLEEP
 
    ; The expiration of the watchdog timer will wake up the MCU from
    ; sleep after ~2 seconds. The trigger out pulse high-time
    ; duration is the duration of the watchdog timer: ___---___
    ; Since the default watchdog timer period value is 2 seconds
    ; typical, the trigger out pulse measured on the oscilloscope
    ; should be approximately 2 seconds.
    NOP
    NOP
    NOP
Loop_101:
    BRA         Loop_101
    ; -----------------------------------------------------