From: ian Date: Fri, 20 Aug 2004 00:34:33 +0000 (+0000) Subject: flash-all actually flashes RD7 too X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=d54397d296721dfd3981edd0ea6b6e78bd5e0009;p=trains.git flash-all actually flashes RD7 too --- diff --git a/.cvsignore b/.cvsignore index b1767e3..5296c88 100644 --- a/.cvsignore +++ b/.cvsignore @@ -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 index 0000000..64c6523 --- /dev/null +++ b/iwjpictest/flash-all.asm @@ -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 diff --git a/pcb/Makefile b/pcb/Makefile index f0faabe..7f6c76c 100644 --- a/pcb/Makefile +++ b/pcb/Makefile @@ -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 $< diff --git a/pic.make b/pic.make index f0faabe..7f6c76c 100644 --- 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 $< diff --git a/spice/Makefile b/spice/Makefile index f0faabe..7f6c76c 100644 --- a/spice/Makefile +++ b/spice/Makefile @@ -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 $<