summaryrefslogtreecommitdiff
path: root/software/ctr/ttx.inc
diff options
context:
space:
mode:
authorChristian Pointner <equinox@mur.at>2012-03-04 21:14:42 +0000
committerChristian Pointner <equinox@mur.at>2012-03-04 21:14:42 +0000
commit5a3bb8920b733baf572aa89d4c63c88003e26763 (patch)
tree6385624f99d290d6dde174911df72708a4a1e2e2 /software/ctr/ttx.inc
parentadded datasheet for PMGD370XN (diff)
moved ttx_crx to ctr
git-svn-id: https://svn.spreadspace.org/mur.sat@272 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'software/ctr/ttx.inc')
-rw-r--r--software/ctr/ttx.inc294
1 files changed, 294 insertions, 0 deletions
diff --git a/software/ctr/ttx.inc b/software/ctr/ttx.inc
new file mode 100644
index 0000000..2e45f28
--- /dev/null
+++ b/software/ctr/ttx.inc
@@ -0,0 +1,294 @@
+ ;;
+ ;; mur.sat
+ ;;
+ ;; Somewhen in the year 2012, mur.at will have a nano satellite launched
+ ;; into a low earth orbit (310 km above the surface of our planet). The
+ ;; satellite itself is a TubeSat personal satellite kit, developed and
+ ;; launched by interorbital systems. mur.sat is a joint venture of mur.at,
+ ;; ESC im Labor and realraum.
+ ;;
+ ;; Please visit the project hompage at sat.mur.at for further information.
+ ;;
+ ;;
+ ;; Copyright (C) 2011 Christian Pointner <equinox@mur.at>
+ ;;
+ ;; This file is part of mur.sat.
+ ;;
+ ;; mur.sat is free software: you can redistribute it and/or modify
+ ;; it under the terms of the GNU General Public License as published by
+ ;; the Free Software Foundation, either version 3 of the License, or
+ ;; any later version.
+ ;;
+ ;; mur.sat is distributed in the hope that it will be useful,
+ ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ;; GNU General Public License for more details.
+ ;;
+ ;; You should have received a copy of the GNU General Public License
+ ;; along with mur.sat. If not, see <http://www.gnu.org/licenses/>.
+ ;;
+
+ ;; -------------------------------------
+dottime
+ movwf TMR0
+ bcf INTCON,T0IF
+dot_inner
+ btfss INTCON,T0IF
+ goto dot_inner
+ clrwdt
+ return
+
+ ;; -------------------------------------
+send_char
+ movwf CHAR
+ movlw 'Z' + 1
+ subwf CHAR,w
+ btfsc STATUS,C
+ return
+ movlw ' '
+ subwf CHAR,f
+ btfss STATUS,C
+ return
+ btfsc STATUS,Z
+ return
+
+ movf CHAR,w
+ call getcw
+ movwf ELEMENT
+ movf CHAR,w
+ call getcwlen
+ movwf ELECNT
+ movf ELECNT,f
+ btfsc STATUS,Z
+ return
+ movf CHAR,w
+ xorwf PARITY,f
+
+char_next_element
+ bsf PORTA,CW_OUT
+ btfss ELEMENT,7
+ movf DOT,w
+ btfsc ELEMENT,7
+ movf DASH,w
+ call dottime
+ bcf PORTA,CW_OUT
+
+ rlf ELEMENT,f
+
+ decfsz ELECNT,f
+ goto char_espace
+ return
+
+char_espace
+ movf ESPACE,w
+ call dottime
+ goto char_next_element
+
+ ;; -------------------------------------
+send_callsign
+ movlw .6
+ movwf CHARCNT
+
+callsign_next_char
+ call callsign
+ call send_char
+ decfsz CHARCNT,f
+ goto callsign_cspace
+ return
+
+callsign_cspace
+ movf CSPACE,w
+ call dottime
+ movf CHARCNT,w
+ goto callsign_next_char
+
+ ;; -------------------------------------
+send_base32
+ movwf PENTLECNT
+
+case0
+ rrf INDF0,w
+ movwf PENTLE0
+ rrf PENTLE0,f
+ rrf PENTLE0,w
+ andlw b'00011111'
+ call base32
+ call send_char
+ decfsz PENTLECNT,f
+ goto case1
+ return
+
+case1
+ movf CSPACE,w
+ call dottime
+ rlf INDF0,w
+ movwf PENTLE0
+ rlf PENTLE0,w
+ andlw b'00011100'
+ movwf PENTLE0
+ incf FSR0L,f
+ swapf INDF0,w
+ movwf PENTLE1
+ rrf PENTLE1,f
+ rrf PENTLE1,w
+ andlw b'00000011'
+ iorwf PENTLE0,w
+ call base32
+ call send_char
+ decfsz PENTLECNT,f
+ goto case2
+ return
+
+case2
+ movf CSPACE,w
+ call dottime
+ rrf INDF0,w
+ andlw b'00011111'
+ call base32
+ call send_char
+ decfsz PENTLECNT,f
+ goto case3
+ return
+
+case3
+ movf CSPACE,w
+ call dottime
+ swapf INDF0,w
+ andlw b'00010000'
+ movwf PENTLE0
+ incf FSR0L,f
+ swapf INDF0,w
+ andlw b'00001111'
+ iorwf PENTLE0,w
+ call base32
+ call send_char
+ decfsz PENTLECNT,f
+ goto case4
+ return
+
+case4
+ movf CSPACE,w
+ call dottime
+ rlf INDF0,w
+ andlw b'00011110'
+ movwf PENTLE0
+ incf FSR0L,f
+ btfsc INDF0,7
+ bsf PENTLE0,0
+ movf PENTLE0,w
+ call base32
+ call send_char
+ decfsz PENTLECNT,f
+ goto case5
+ return
+
+case5
+ movf CSPACE,w
+ call dottime
+ rrf INDF0,w
+ movwf PENTLE0
+ rrf PENTLE0,w
+ andlw b'00011111'
+ call base32
+ call send_char
+ decfsz PENTLECNT,f
+ goto case6
+ return
+
+case6
+ movf CSPACE,w
+ call dottime
+ swapf INDF0,w
+ movwf PENTLE0
+ rrf PENTLE0,w
+ andlw b'00011000'
+ movwf PENTLE0
+ incf FSR0L,f
+ swapf INDF0,w
+ movwf PENTLE1
+ rrf PENTLE1,w
+ andlw b'00000111'
+ iorwf PENTLE0,w
+ call base32
+ call send_char
+ decfsz PENTLECNT,f
+ goto case7
+ return
+
+case7
+ movf CSPACE,w
+ call dottime
+ movf INDF0,w
+ andlw b'00011111'
+ call base32
+ call send_char
+ decfsz PENTLECNT,f
+ goto caseend
+ return
+
+caseend
+ movf CSPACE,w
+ call dottime
+ incf FSR0L,f
+ goto case0
+
+ ;; -------------------------------------
+send_cnt
+ rlf BEACONCNTL,w
+ movwf TMP2
+ rlf BEACONCNTH,w
+ movwf TMP1
+ movlw TMP1
+ movwf FSR0L
+ clrf FSR0H
+ movlw .3
+ call send_base32
+ return
+
+ ;; -------------------------------------
+send_parity
+ movf PARITY,w
+ btfsc PARITY,5
+ xorlw b'00000001'
+ andlw b'00011111'
+ call base32
+ call send_char
+
+ movf WSPACE,w
+ call dottime
+ return
+
+ ;; -------------------------------------
+send_beacon
+ bsf PORTA,CW_ENABLE
+ movf TUNE,w
+ call dottime
+ clrf PARITY
+
+ movlw START_CHAR
+ call send_char
+
+ movf WSPACE,w
+ call dottime
+
+ call send_callsign
+
+ movf WSPACE,w
+ call dottime
+
+ call send_cnt
+
+ movf WSPACE,w
+ call dottime
+
+ call send_parity
+
+ incfsz BEACONCNTL,f
+ goto beacon_end
+ incf BEACONCNTH,f
+ ;; TODO write new cnt value to EEPROM
+
+beacon_end
+ bcf PORTA,CW_ENABLE
+ return
+ ;; -------------------------------------