chiark / gitweb /
undo broken deletion
[trains.git] / iwjpictest / flasher.asm
1 ; -*- fundamental -*-
2
3 ; This program:
4 ;   * flashes PER-PIC-LED (pin 21) with the pattern
5 ;      [ L-L-Z L-H-Z L-H-L-H-Z L-H-L-H-L-H-Z ]
6 ;     where each state lasts approx. 160ms (at 20MHz clock).
7 ;   * leaves all other pins set to their default states (usually Z).
8
9         include         /usr/share/gputils/header/p18f458.inc
10         radix           dec
11
12 delay_countfast         equ             0x00
13 delay_countmedium       equ             0x01
14 delay_countslow         equ             0x02
15
16 clock equ mclock
17  include clockvaries.inc
18         code
19
20 start
21 loop
22         call            red
23         call            red
24         call            black
25
26         call            red
27         call            green
28         call            black
29
30         call            red
31         call            green
32         call            red
33         call            green
34         call            black
35
36         call            red
37         call            green
38         call            red
39         call            green
40         call            red
41         call            green
42         call            black
43         goto            loop
44
45 red
46         bcf             TRISD, 2, 0             ; enable flasher output
47         bcf             LATD, 2, 0              ; set to low
48         goto            delay
49
50 green
51         bcf             TRISD, 2, 0             ; enable flasher output
52         bsf             LATD, 2, 0              ; set to high
53         goto            delay
54
55 black
56         bsf             TRISD, 2, 0             ; disable flasher output
57         call            delay
58         goto            delay
59
60  define_busywait_delay
61
62         end