diff options
author | Christian Pointner <equinox@mur.at> | 2011-12-13 02:24:23 +0000 |
---|---|---|
committer | Christian Pointner <equinox@mur.at> | 2011-12-13 02:24:23 +0000 |
commit | 6678683a4f3730388f4923080a49c13738fb2eee (patch) | |
tree | 2013a64dfde895a18ee00a7071c4c09d3186e320 /software/idm/idm.asm | |
parent | moved i2c stuff to seperate file (diff) |
cleanup
git-svn-id: https://svn.spreadspace.org/mur.sat@226 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'software/idm/idm.asm')
-rw-r--r-- | software/idm/idm.asm | 79 |
1 files changed, 38 insertions, 41 deletions
diff --git a/software/idm/idm.asm b/software/idm/idm.asm index 3dc9538..7572d45 100644 --- a/software/idm/idm.asm +++ b/software/idm/idm.asm @@ -8,10 +8,10 @@ ;; 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 @@ -34,46 +34,43 @@ include "p16f887.inc" __config _CONFIG1, _DEBUG_OFF & _LVP_OFF & _FCMEN_OFF & _IESO_OFF & _BOR_NSLEEP & _CPD_OFF & _CP_OFF & _MCLRE_OFF & _PWRTE_ON & _WDT_OFF & _INTRC_OSC_CLKOUT __config _CONFIG2, _BOR21V & _WRT_OFF - + ;; ------------------------------------- ;; DEFINES - ;; constants + ;; constants BUF_PAGE_LEN EQU H'0050' BUF_PAGE_CNT EQU H'0004' BUF_OFFSET EQU H'0020' - ;; FLAGS -UNDERRUN EQU .0 -OVERRUN EQU .1 - -CTS EQU .7 - ;; I/O Pins ;; PortA DBG1 EQU .4 DBG2 EQU .5 ;; PortC - ;; variables - ;; page 0 only - - - ;; all pages +;; page 0 only + + +;; all pages RX_BYTE EQU H'0070' WAIT_CNT EQU H'0071' FLAGS EQU H'0072' - + WBUF_PAGE_PTR EQU H'0074' WBUF_PAGE_NUM EQU H'0075' RBUF_PAGE_PTR EQU H'0076' RBUF_PAGE_NUM EQU H'0077' - + W_TEMP EQU H'007E' STATUS_TEMP EQU H'007F' - ;; bits - + ;; bits +;; FLAGS +UNDERRUN EQU .0 +OVERRUN EQU .1 +CTS EQU .7 + ;; ------------------------------------- ;; Reset Vector org 0 @@ -86,7 +83,7 @@ STATUS_TEMP EQU H'007F' movwf W_TEMP swapf STATUS,W movwf STATUS_TEMP - + bcf STATUS,RP0 bcf STATUS,RP1 @@ -118,11 +115,11 @@ int_tmr2_adcon goto int_tmr2_end movf ADRESH,w movwf INDF - + int_tmr2_end bcf PIR1,TMR2IF goto interrupt_end - + int_uart_tx call rbuf_next @@ -140,7 +137,7 @@ int_uart_rx btfss RCSTA,OERR goto int_uart_rx_oe goto interrupt_end - + int_uart_rx_oe bcf RCSTA,CREN bsf RCSTA,CREN @@ -174,7 +171,7 @@ init movwf CM1CON0 movlw b'10010000' movwf CM2CON0 - + ;; bank 1 bsf STATUS,RP0 bcf STATUS,RP1 @@ -204,9 +201,9 @@ init ; movlw .156 ;; ~50Hz / ~200Hz movwf PR2 clrf ADCON1 - + ;; bank 0 - bcf STATUS,RP0 + bcf STATUS,RP0 bcf STATUS,RP1 movlw b'10010000' movwf RCSTA @@ -220,7 +217,7 @@ init clrf TMR2 movlw b'10010101' movwf ADCON0 - + bcf PORTA,DBG1 bcf PORTA,DBG2 @@ -273,7 +270,7 @@ wait_loop uart_rx_byte btfsc RCSTA,FERR goto uart_rx_fe - movf RCREG,w ; TODO: move to input string + movf RCREG,w movwf RX_BYTE return @@ -290,12 +287,12 @@ wbuf_reset bcf FLAGS,OVERRUN bcf PORTA,DBG1 - + ;; ------------------- wbuf_next btfsc FLAGS,UNDERRUN goto wbuf_move_ptr - + movf RBUF_PAGE_NUM,w xorwf WBUF_PAGE_NUM,w btfss STATUS,Z @@ -310,7 +307,7 @@ wbuf_next bsf PORTA,DBG1 return - + wbuf_move_ptr bcf FLAGS,UNDERRUN bcf PORTA,DBG2 @@ -337,7 +334,7 @@ wbuf_next_page wbuf_next_cycle movlw BUF_PAGE_CNT - 1 movwf WBUF_PAGE_NUM - + wbuf_fill_fsr movlw BUF_OFFSET addwf WBUF_PAGE_PTR,w @@ -367,7 +364,7 @@ rbuf_reset bcf STATUS,RP0 bcf FLAGS,CTS - + ;; ------------------- rbuf_next btfsc FLAGS,OVERRUN @@ -390,7 +387,7 @@ rbuf_next bcf STATUS,RP0 return - + rbuf_move_ptr bcf FLAGS,OVERRUN bcf PORTA,DBG1 @@ -413,7 +410,7 @@ rbuf_next_page rbuf_next_cycle movlw BUF_PAGE_CNT - 1 movwf RBUF_PAGE_NUM - + rbuf_fill_fsr movlw BUF_OFFSET addwf RBUF_PAGE_PTR,w @@ -436,15 +433,15 @@ main movlw 'r' xorwf RX_BYTE,w btfsc STATUS,Z - goto cmd_read + goto cmd_read movlw 'n' xorwf RX_BYTE,w btfsc STATUS,Z - goto cmd_noread + goto cmd_noread movlw 's' xorwf RX_BYTE,w btfsc STATUS,Z - goto cmd_start + goto cmd_start movlw 'p' xorwf RX_BYTE,w btfsc STATUS,Z @@ -467,15 +464,15 @@ cmd_start clrf RX_BYTE goto main -cmd_stop +cmd_stop clrf RX_BYTE goto main - + powerdown sleep nop goto main - + ;; ------------------------------------- ;; END end |