chiark / gitweb /
flash-all actually flashes RD7 too
authorian <ian>
Fri, 20 Aug 2004 00:34:33 +0000 (00:34 +0000)
committerian <ian>
Fri, 20 Aug 2004 00:34:33 +0000 (00:34 +0000)
.cvsignore
iwjpictest/flash-all.asm [new file with mode: 0644]
pcb/Makefile
pic.make
spice/Makefile

index b1767e314efc590c421d3e9f0047e37127e36ca1..5296c88978a4d92f97c0202d80882392541f9cc7 100644 (file)
@@ -21,3 +21,6 @@ divider-table.txt
 flasher.lst
 flasher.hex
 flasher.cod
+flash-all.lst
+flash-all.hex
+flash-all.cod
diff --git a/iwjpictest/flash-all.asm b/iwjpictest/flash-all.asm
new file mode 100644 (file)
index 0000000..64c6523
--- /dev/null
@@ -0,0 +1,64 @@
+;
+
+       include         /usr/share/gputils/header/p18f458.inc
+
+;      __config        _CONFIG1L, 0xff
+       __config        _CONFIG1H, _OSCS_OFF_1H & _ECIO_OSC_1H
+       __config        _CONFIG2L, _BOR_ON_2L & _PWRT_ON_2L & _BORV_45_2L
+       __config        _CONFIG2H, _WDT_OFF_2H
+;      __config        _CONFIG3L, 0xff
+;      __config        _CONFIG3H, 0xff
+       __config        _CONFIG4L, _DEBUG_OFF_4L & _LVP_OFF_4L & _STVR_ON_4L
+;      __config        _CONFIG4H, 0xff
+       __config        _CONFIG5L, 0xff
+       __config        _CONFIG5H, 0xff
+       __config        _CONFIG6L, 0xff
+       __config        _CONFIG6H, 0xff
+       __config        _CONFIG7L, 0xff
+       __config        _CONFIG7H, 0xff
+
+ACCSFR         equ             0x0f00
+
+COUNTFAST      equ             0x00
+COUNTMEDIUM    equ             0x01
+COUNTSLOW      equ             0x02
+
+SLOWEXP                equ             3       ; 2^3 * 40ms = 320ms
+
+; we always leave each loop when its counter has reached 0, so on
+; entry we assume it's already 0.  For the loops which want to
+; count all the way (256 iterations) that's good.
+
+start
+       bcf             TRISA-ACCSFR, 0, 0
+loop
+       btg             LATA-ACCSFR, 0, 0
+       btg             LATD-ACCSFR, 7, 0
+
+       ; set a bit which says how fast the led
+       ; should flash and count down from 2^(that bit)
+       bsf             COUNTSLOW, SLOWEXP, 0
+delayslow_loop
+
+delaymedium_loop
+
+delayfast_loop
+       decfsz          COUNTFAST, 1, 0         ; 1 cycle
+       goto            delayfast_loop          ; 2 cycles (skipped or not)
+; exited delayfast_loop                                ; total: 3 * 256 = 768 cycles
+                                               
+
+       decfsz          COUNTMEDIUM, 1, 0       ; 1 cycle
+       goto            delaymedium_loop        ; 2 cycles (skipped or not)
+; exited delaymedium_loop                      ; total: ~198000 cycles
+
+                                               ; each cycle 0.2us
+                                               ; so each medium loop is ~40ms
+
+       decfsz          COUNTSLOW, 1, 0
+       goto            delayslow_loop
+; exited delayslow_loop
+
+       goto            loop
+
+       end
index f0faabec78544e0f7c254cb996259c07f7cf6451..7f6c76cd987d9c17eb6da36bbb9ac8f3ce77c80d 100644 (file)
@@ -27,7 +27,7 @@ o=>$@.new && mv -f $@.new $@
 CIRCUITPARTS=  control.partlist circuit.partlist
 BULKRESPARTS=  bulkres-select.partlist bulkres-items.partlist
 
-picprogs:      flasher.hex
+picprogs:      flasher.hex flash-all.hex
 
 %.hex:         %.asm
                gpasm -p 18f458 $<
index f0faabec78544e0f7c254cb996259c07f7cf6451..7f6c76cd987d9c17eb6da36bbb9ac8f3ce77c80d 100644 (file)
--- a/pic.make
+++ b/pic.make
@@ -27,7 +27,7 @@ o=>$@.new && mv -f $@.new $@
 CIRCUITPARTS=  control.partlist circuit.partlist
 BULKRESPARTS=  bulkres-select.partlist bulkres-items.partlist
 
-picprogs:      flasher.hex
+picprogs:      flasher.hex flash-all.hex
 
 %.hex:         %.asm
                gpasm -p 18f458 $<
index f0faabec78544e0f7c254cb996259c07f7cf6451..7f6c76cd987d9c17eb6da36bbb9ac8f3ce77c80d 100644 (file)
@@ -27,7 +27,7 @@ o=>$@.new && mv -f $@.new $@
 CIRCUITPARTS=  control.partlist circuit.partlist
 BULKRESPARTS=  bulkres-select.partlist bulkres-items.partlist
 
-picprogs:      flasher.hex
+picprogs:      flasher.hex flash-all.hex
 
 %.hex:         %.asm
                gpasm -p 18f458 $<