chiark / gitweb /
reverse.asm uses slave_table instead of its own table; new file energy.asm compiles...
authorian <ian>
Fri, 23 Dec 2005 01:04:42 +0000 (01:04 +0000)
committerian <ian>
Fri, 23 Dec 2005 01:04:42 +0000 (01:04 +0000)
detpic/Makefile
detpic/energy.asm
detpic/energy.fin
detpic/final.inc
detpic/morse.messages
detpic/program.asm
detpic/reverse.asm

index a6dfd84c2aec455dbd377a0c2f7284352921fe57..b42be349c397da101315626697e108e159bb8f60 100644 (file)
@@ -5,7 +5,8 @@ PICNOS=         0 1 2
 PROGRAMS=              program
 OBJS_program=          vectors.o panic.o routines-led.o i2clib.o       \
                        misc.o detect.o variables.o points.o serout.o   \
-                       syncwrite.o mascan.o reverse.o nmra-stream.o
+                       syncwrite.o mascan.o energy.o                   \
+                       reverse.o nmra-stream.o
 XCODEN_program=        morse
 XCODE1_program=        ours+pindata
 
@@ -13,6 +14,7 @@ INCLUDES=                                     \
                ../iwjpictest/clockvaries.inc   \
                common.inc                      \
                detect.inc                      \
+               energy.fin                      \
                final.inc                       \
                i2clib.inc                      \
                i2clib.incm                     \
index 8511e57efffa41c1da3bef09665e19d70a0a34d7..dab5b8006971ee0134f6f80aecdf46f6f38ff7c8 100644 (file)
@@ -1,7 +1,13 @@
 ;======================================================================
+; TRACK POWER AND SHORT CIRCUIT
 
+ include common.inc
+ code
+
+;======================================================================
 command_power
 ;  C           1 iff command is ON             undefined
+       panic   morse_UEC
 
 ;power_on ???
 ; from cebpic/nmra-stream.asm's setup
@@ -10,10 +16,8 @@ command_power
 
        bcf     PORTB,0,0       ; user fault L or Z
 
+power_polarising
+       panic   morse_UER
 
-master_interrupt_high
-; either booster timer interrupt or short circuit
-       panic   morse_UES       ; fixme check short circuit
-       call    nmra_interrupt_timer
-
-trackpower_polarising
+;======================================================================
+ include final.inc
index c606e0619f0fa121d1ed0b9fde65dacc73e97c20..c0549dbba6a6214a0bc9d259ae48846515e83062 100644 (file)
@@ -1,2 +1,2 @@
  extern command_power
- extern power_reversing
+ extern power_polarising
index d8c08c0e2e90eac70e09aeaf55b51cce5f5c8378..6e5ede9c959adc57beedb4ea239623023c1e37ad 100644 (file)
@@ -1,12 +1,12 @@
  include ../iwjpictest/syncwrite.inc
  include detect.inc
+ include energy.fin
  include i2clib.inc
  include mascan.fin
  include misc.fin
  include nmra-stream.fin
  include panic.fin
  include points.fin
- include power.fin
  include program.fin
  include reverse.fin
  include routines-led.fin
index 495fb4a4d35663fa7cc1b6621a9d258d20114a84..277d0530be002195338ed126da02eb26350fc83e 100644 (file)
@@ -57,6 +57,10 @@ UC
 UI
 UG
 UX
+UES
+UER
+UEC
+URM
 UCI
 UCP
 
index c4a436d74cc580e2a09e1a61dffd3306c95e5824..4495191e788264d0f01f62d7c584b10062e88862 100644 (file)
@@ -90,6 +90,8 @@ serialrx_table_section        code    0x2000
 
 ;--------------------
 serialrx_generalmsg
+;command_<something>  has same calling convention:
+;
 ;  FSR0 ->     start of message                undefined
 ;  *FSR0       message                         undefined
 ;
@@ -160,7 +162,6 @@ serialrx_bad
 
 ;--------------------
 command_ping
-command_power
 command_point
 command_crashed
        panic   morse_UC
index c6829dde2e1e24936db4066a7030a51a4c75668d..892e535334ff842c050425bbd2baee515623eb5d 100644 (file)
@@ -13,13 +13,10 @@ maske                               res     1
 ;----------------------------------------
 ; MASTER - Access bank variables and other sections
 
- udata
-polarities_commanded_buffer    res     maxpics+1
-       ; Each byte is:
-       ;       11RRRRRRR       reverse command for slave, waiting to write
-       ;       000000001       that pic is not a reversers pic
-       ;       000000000       we have written any relevant command
-       ;       000000002       sentinel
+; values for ste_revcmd:
+       ;       11RRRRRR        reverse command for slave, waiting to write
+       ;       00000001        this is not a reversers pic
+       ;       00000000        we have written any relevant command
 
 ;======================================================================
 ; LOCAL REVERSERS
@@ -115,13 +112,7 @@ command_polarity
 ;              and so on until f for bit 5.  (See polarity_do_here, below.)
 ;
 ; we accumulate (`gather') the `g' bits in t.
-;
-
- panic morse_UM
-;;     mov_lfsr message_buffer_start,0
-
-
-       mov_lfsr polarities_commanded_buffer,1
+       mov_lfsr slavetable + ste_revcmd, 1
        mov_fw  POSTINC0        ; W =           10010RRR
        mov_wf  t               ; t =           10010ggg
        xor_lw  b'10001000'     ; t =           00011ggg
@@ -150,15 +141,19 @@ board
                                ; FSR1 -> pic we've just filled
 ;...
 board_next_loop
-       dec_fw  PREINC1         ; FSR1 -> pic after one we're testing
-                               ; W = 1???????  existing reverse command
+       mov_lw  ste_size
+       add_wff FSR1L           ; FSR1 -> pic after one we're testing
+    if ste_szln2 + maxpics_ln2 == 8
+       bra_c   board_next_none
+    else
+       error "reliance on carry flag for incrementing FSR1 fails"
+    endif
+       dec_fw  INDF1           ; W = 1???????  existing reverse command
                                ;     00000000  not a reversers pic
                                ;     ffffffff  no existing command
-                               ;     00000001  sentinel
        bra_z   board_next_loop ; not a reversers pic
-       bra_nn  board_next_none ; sentinel
 
-       bt_f_if0 INDF1,       ;     1.......  existing command
+       bt_f_if0 INDF1, 7       ;     1.......  existing command
                                ;     0.......  no existing command
        inc_f   polarities_waiting
        return
@@ -171,16 +166,14 @@ board_next_none
 ; now we're exiting from the loop in when_reverse_message_found
        pop      ; that disposes of the call to `board'
 
-       goto    trackpower_decide
-       ; that will turn it off, since polarities_waiting is nonzero
+       call    power_polarising
+       mov_lfsr slavetable + ste_revcmd, 1
+       mov_fw  INDF1 ; there's always a board 0, us:
+       goto    polarity_local_do
 
 ;----------
 board_next_none_more_message
        panic   morse_RL
 
-;----------
-trackpower_decide
-       panic   morse_UE
-
 ;======================================================================
  include final.inc