summaryrefslogtreecommitdiff
path: root/blink.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2008-12-18 12:17:41 -0800
committerKeith Packard <keithp@keithp.com>2008-12-18 12:17:41 -0800
commit3779cc8b32cac3640f42bd0400d4199ddae965a1 (patch)
treee15be68014f2a82e0b2a78f97463b86d0c412d59 /blink.c
parentdc03adc179669d41e3551d74b3c5a60db41ff217 (diff)
cq
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'blink.c')
-rw-r--r--blink.c49
1 files changed, 40 insertions, 9 deletions
diff --git a/blink.c b/blink.c
index fcbc04d0..f8cf7827 100644
--- a/blink.c
+++ b/blink.c
@@ -24,21 +24,52 @@ sfr at 0xF7 P2INP;
nop \
_endasm;
+void
+delay (int n)
+{
+ int i, j, k;
+
+ for (k = 0; k < n; k++) {
+ for (j = 0; j < 100; j++)
+ for (i = 0; i < 1000; i++)
+ nop();
+ }
+}
+
+void
+dit() {
+ P1 = 0xff;
+ delay(1);
+ P1 = 0xfd;
+ delay(1);
+}
+
+void
+dah () {
+ P1 = 0xff;
+ delay(3);
+ P1 = 0xfd;
+ delay(1);
+}
+
+void
+charspace () {
+ delay(2);
+}
+
+void
+wordspace () {
+ delay(8);
+}
+
main ()
{
- int i, j;
/* Set p1_1 to output */
P1DIR = 0x02;
P1INP = 0x00;
P2INP = 0x00;
for (;;) {
- P1 = 0xff;
- for (j = 0; j < 100; j++)
- for (i = 0; i < 1000; i++)
- nop();
- P1 = 0xfd;
- for (j = 0; j < 100; j++)
- for (i = 0; i < 1000; i++)
- nop();
+ dah(); dit(); dah(); dit(); charspace ();
+ dah(); dah(); dit(); dah(); wordspace();
}
}