diff options
author | Christian Pointner <equinox@mur.at> | 2011-07-25 03:16:27 +0000 |
---|---|---|
committer | Christian Pointner <equinox@mur.at> | 2011-07-25 03:16:27 +0000 |
commit | b78263418ff7b14255a250569a03df05123ff56f (patch) | |
tree | 3cf4b3a079fa3e876792ea2bb37aa8ca43754cf5 /software/ihu/ihu.asm | |
parent | first working communication between ihu and ttx (diff) |
communication speed ihu -> ttx is now right
git-svn-id: https://svn.spreadspace.org/mur.sat@55 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'software/ihu/ihu.asm')
-rw-r--r-- | software/ihu/ihu.asm | 82 |
1 files changed, 19 insertions, 63 deletions
diff --git a/software/ihu/ihu.asm b/software/ihu/ihu.asm index bf87899..dce1fa7 100644 --- a/software/ihu/ihu.asm +++ b/software/ihu/ihu.asm @@ -54,6 +54,7 @@ TTX_SDA EQU 7 TMP EQU H'0020' TTX_BYTE EQU H'0021' TTX_CNT EQU H'0022' +WAIT_CNT EQU H'0023' ;; all pages W_TEMP EQU H'007E' @@ -113,7 +114,7 @@ init ;; bank 1 bsf STATUS,RP0 bcf STATUS,RP1 - movlw b'11000111' + movlw b'11000001' movwf OPTION_REG clrf PSTRCON movlw b'00010000' @@ -157,6 +158,20 @@ init ;; ------------------------------------- ;; SUBROUTINES +wait_ms + movwf WAIT_CNT +wait_next + movlw .9 + movwf TMR0 + bcf INTCON,T0IF +wait_loop + btfss INTCON,T0IF + goto wait_loop + decfsz WAIT_CNT,f + goto wait_next + return + + ;; ------------------------------------- uart_rx_byte btfsc RCSTA,FERR goto uart_rx_fe @@ -170,26 +185,11 @@ uart_rx_fe ;; ------------------------------------- ttx_send_byte - bsf PORTD,TTX_SCL movwf TTX_BYTE - clrf TTX_CNT + bsf PORTD,TTX_SCL + movlw .3 bcf PORTD,TTX_SCL -ttx_pre - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - decfsz TTX_CNT,f - goto ttx_pre + call wait_ms movlw .8 movwf TTX_CNT ttx_next_bit @@ -201,48 +201,11 @@ ttx_next_bit nop nop nop - nop - nop - nop - nop - nop - nop - nop - nop bcf PORTD,TTX_SCL nop nop nop nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop rlf TTX_BYTE,f decfsz TTX_CNT,f goto ttx_next_bit @@ -256,16 +219,9 @@ main btfsc STATUS,Z goto main - bcf PORTD,DTMF_PWRDWN - bcf INTCON,T0IF - clrf TMR0 movf TMP,w call ttx_send_byte clrf TMP -loop - btfss INTCON,T0IF - goto loop - bsf PORTD,DTMF_PWRDWN goto main powerdown |