diff options
-rw-r--r-- | software/ihu/ihu.asm | 82 | ||||
-rw-r--r-- | software/ttx/ttx.asm | 5 |
2 files changed, 20 insertions, 67 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 diff --git a/software/ttx/ttx.asm b/software/ttx/ttx.asm index 454e10c..e01374c 100644 --- a/software/ttx/ttx.asm +++ b/software/ttx/ttx.asm @@ -114,9 +114,6 @@ ext_int bcf STATUS,RP0 movlw .8 movwf RX_CNT -ext_int_clk_low - btfsc GPIO,SCLK - goto ext_int_clk_low ext_int_clk_high btfss GPIO,SCLK goto ext_int_clk_high @@ -134,7 +131,7 @@ ext_int_clk_high ext_int_rx_next rlf RX_BYTE,f - goto ext_int_clk_low + goto ext_int_clk_high tmr1_int bcf STATUS,RP0 |