From 8b4317140cd45a4c155ef83325664fc8e55cedf6 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 2 May 2011 17:24:04 +0000 Subject: ttx: beacon interval git-svn-id: https://svn.spreadspace.org/mur.sat@5 7de4ea59-55d0-425e-a1af-a3118ea81d4c --- software/ttx/ttx.asm | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'software') diff --git a/software/ttx/ttx.asm b/software/ttx/ttx.asm index a3a38ee..caaef8c 100644 --- a/software/ttx/ttx.asm +++ b/software/ttx/ttx.asm @@ -36,7 +36,9 @@ ;; ------------------------------------- ;; DEFINES - +BEACON_INT EQU .60 ; send a beacon every 60 seconds +SECCNT EQU H'0008' + ;; ------------------------------------- ;; OFFSET org 0 @@ -44,13 +46,15 @@ ;; ------------------------------------- ;; INIT init - ;; bsf CMCON0,NOT_COUTEN bcf CMCON0,CMPON movlw b'11110110' option movlw b'11111110' tris GPIO bsf GPIO,GP0 + clrf TMR0 + movlw BEACON_INT + movwf SECCNT ;; ------------------------------------- ;; MAINLOOP @@ -58,16 +62,23 @@ main movf TMR0,w btfss STATUS,Z goto main - - bcf GPIO,GP0 + ;; this gets called every second + decfsz SECCNT,f + goto waitfor0 + movlw BEACON_INT + movwf SECCNT + + ;; this gets called every BEACON_INT seconds + movlw b'00000001' + xorwf GPIO,f + + ;; is the timer above zero? waitfor0 movf TMR0,w btfsc STATUS,Z goto waitfor0 - bsf GPIO,GP0 - goto main ;; ------------------------------------- -- cgit v1.2.3