summaryrefslogtreecommitdiff
path: root/software/ttx/ttx.asm
diff options
context:
space:
mode:
authorChristian Pointner <equinox@mur.at>2011-07-23 02:40:47 +0000
committerChristian Pointner <equinox@mur.at>2011-07-23 02:40:47 +0000
commitd741e0e2b1460326c01e3f2f2db50ab6689e2d70 (patch)
tree575c6748cee6ae970500cca826f0cb1037eed3d6 /software/ttx/ttx.asm
parentadded volatile beacon cnt (diff)
added safe mode checks
git-svn-id: https://svn.spreadspace.org/mur.sat@39 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'software/ttx/ttx.asm')
-rw-r--r--software/ttx/ttx.asm22
1 files changed, 19 insertions, 3 deletions
diff --git a/software/ttx/ttx.asm b/software/ttx/ttx.asm
index fa0511c..0100a13 100644
--- a/software/ttx/ttx.asm
+++ b/software/ttx/ttx.asm
@@ -66,12 +66,16 @@ PENTLECNT EQU H'0047'
BUF EQU H'0050'
;; all pages
-BEACONCNTH EQU H'007C'
-BEACONCNTL EQU H'007B'
+STATE EQU H'007A'
+BEACONCNTH EQU H'007B'
+BEACONCNTL EQU H'007C'
SECCNT EQU H'007D'
W_TEMP EQU H'007E'
STATUS_TEMP EQU H'007F'
+ ;; bits STATE
+safe EQU .0
+
;; -------------------------------------
;; Reset Vector
org .0
@@ -96,10 +100,18 @@ ext_int
tmr1_int
bcf PIR1,TMR1IF
+ btfsc STATE,safe ; safe mode -> disable scheduler
+ goto disable_tmr1
movf SECCNT,w
btfss STATUS,Z
decf SECCNT,f
+ goto interrupt_end
+disable_tmr1
+ bcf T1CON,TMR1ON
+ movlw BEACON_INT
+ movwf SECCNT
+
interrupt_end
;; restore context
swapf STATUS_TEMP,W
@@ -129,7 +141,7 @@ init
;; bank 0
clrf TMR1L
clrf TMR1H
- movlw b'00000111'
+ movlw b'00000110'
movwf T1CON
movlw b'01000000' ; enable external interrupt bit4
movwf INTCON
@@ -143,8 +155,12 @@ init
movlw BEACON_INT
movwf SECCNT
+ clrf STATE ; TODO: read State from EEPROM
clrf BEACONCNTL ; TODO: read Beaconcnt from EEPROM
clrf BEACONCNTH
+
+ btfss STATE,safe ; safe mode -> disable scheduler
+ bsf T1CON,TMR1ON
bsf INTCON,GIE
goto main