summaryrefslogtreecommitdiff
path: root/software
diff options
context:
space:
mode:
authorChristian Pointner <equinox@mur.at>2011-07-22 15:56:00 +0000
committerChristian Pointner <equinox@mur.at>2011-07-22 15:56:00 +0000
commit858302529240abe3ac870a50beb561978171c3cd (patch)
treeab95d014843e8d697042e565b49663e295e70d3e /software
parentupdated protocol docs (diff)
beacon with powerdown works now
git-svn-id: https://svn.spreadspace.org/mur.sat@33 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'software')
-rw-r--r--software/ttx/dottime.calc49
-rw-r--r--software/ttx/nmx-calc.odsbin16807 -> 0 bytes
-rw-r--r--software/ttx/ttx.asm36
3 files changed, 23 insertions, 62 deletions
diff --git a/software/ttx/dottime.calc b/software/ttx/dottime.calc
deleted file mode 100644
index 5a793f1..0000000
--- a/software/ttx/dottime.calc
+++ /dev/null
@@ -1,49 +0,0 @@
- movlw n 1 +
- call dottime 2 |
----------------- |
-dottime |
- movwf DOTCNT1 1 |
-dot_outer |
- movlw m 1 + |
- movwf DOTCNT0 1 | |
-dot_inner + | |
- x * nop x | y | z | t
- decfsz DOTCNT0,f 1 (2) | | |
- goto dot_inner 2 + | |
- decfsz DOTCNT1,f 1 (2) | |
- goto dot_outer 2 + |
- return 2 +
-
-
-
- y = (x + 1 + 2) * m - 1 = xm + 3m - 1
- z = (1 + 1 + y + 1 + 2) * n - 1 = (4 + xm + 3m) * n - 1 = 4n + 3mn + xmn - 1
-
- t = 1 + 2 + 1 + z + 2 = 5 + 4n + 3mn + xmn
- = ==================
-
- @ n = m = 256 (0): tmax = 197637 + 65536x µs
- @ n = m = 1: tmin = 12 + x µs
-
-for x=0: tmin = 12, tmax = 197637
- x=1: tmin = 13, tmax = 263173
- x=2: tmin = 14, tmax = 328709
- x=3: tmin = 15, tmax = 394245
- x=4: tmin = 16, tmax = 459781
- x=5: tmin = 17, tmax = 525317
- x=6: tmin = 18, tmax = 590853
- x=7: tmin = 19, tmax = 656389
-
-
-m(dot) = m(dot) = 36
-m(dash) = 3*m(dot) = 108
-m(element space) = m(dot) = 36
-m(character space) = 3*m(dot) = 108
-m(word space) = 7*m(dot) = 252
-
- @ m = 36; tmax = 5 + 112n + 36xn
- @ m = 108: tmax = 5 + 328n + 108xn
- @ m = 252: tmax = 5 + 760n + 252xn
-
- n => CWSPEED
- x => nop count \ No newline at end of file
diff --git a/software/ttx/nmx-calc.ods b/software/ttx/nmx-calc.ods
deleted file mode 100644
index 8b85fb8..0000000
--- a/software/ttx/nmx-calc.ods
+++ /dev/null
Binary files differ
diff --git a/software/ttx/ttx.asm b/software/ttx/ttx.asm
index 38b9254..b6b7bbb 100644
--- a/software/ttx/ttx.asm
+++ b/software/ttx/ttx.asm
@@ -32,11 +32,11 @@
LIST p=12F635
include "p12f635.inc"
- __config _WUREN_ON & _FCMEN_OFF & _IESO_OFF & _BOD_OFF & _CPD_OFF & _CP_OFF & _MCLRE_OFF & _PWRTE_OFF & _WDT_OFF & _INTRC_OSC_NOCLKOUT
+ __config _WUREN_OFF & _FCMEN_OFF & _IESO_OFF & _BOD_OFF & _CPD_OFF & _CP_OFF & _MCLRE_OFF & _PWRTE_OFF & _WDT_OFF & _INTRC_OSC_NOCLKOUT
;; -------------------------------------
;; DEFINES
-BEACON_INT EQU .3 ; *2 = Beacon Interval in seconds
+BEACON_INT EQU .21 ; *2 = Beacon Interval in seconds
SECCNT EQU H'007D'
CHAR EQU H'0041'
@@ -60,25 +60,31 @@ STATUS_TEMP EQU H'007F'
;; -------------------------------------
;; Reset Vector
- org 0
+ org .0
goto init
;; -------------------------------------
;; Interrupt Vector
- org 4
+ org .4
;; save context
movwf W_TEMP
swapf STATUS,W
movwf STATUS_TEMP
- btfss INTCON,INTF
+ bcf STATUS,RP0
+ bcf STATUS,RP1
+
+ btfsc PIR1,TMR1IF
goto tmr1_int
ext_int
;; TODO: read bit from GPIO,SDAT and add to received string
goto interrupt_end
tmr1_int
- decf SECCNT,f
+ bcf PIR1,TMR1IF
+ movf SECCNT,w
+ btfss STATUS,Z
+ decf SECCNT,f
interrupt_end
;; restore context
@@ -99,7 +105,7 @@ init
movwf OPTION_REG
movlw b'11111100'
movwf TRISIO
- movlw b'10000001'
+ movlw b'00000001'
movwf PIE1
movlw b'00000000'
movwf OSCCON
@@ -107,13 +113,16 @@ init
bcf STATUS,RP0
;; bank 0
- movlw b'01010000'
- movwf INTCON
+ clrf TMR1L
+ clrf TMR1H
movlw b'00000111'
movwf T1CON
+ movlw b'01000000' ; enable external interrupt bit4
+ movwf INTCON
+
movlw b'00000111'
movwf CMCON0
-
+
bcf GPIO,CWOUT
bcf GPIO,CWENABLE
@@ -329,13 +338,14 @@ main
btfss STATUS,Z
goto powerdown
- ;; this gets called every BEACON_INT*2 seconds
+ ;; this gets called every 2*BEACON_INT seconds
movlw BEACON_INT
- movwf SECCNT
+ movwf SECCNT
call send_beacon
-
+
powerdown
sleep
+ nop
goto main
;; -------------------------------------