diff options
Diffstat (limited to 'software')
-rw-r--r-- | software/ihu/ihu.asm | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/software/ihu/ihu.asm b/software/ihu/ihu.asm index 9c762f6..fba1121 100644 --- a/software/ihu/ihu.asm +++ b/software/ihu/ihu.asm @@ -52,7 +52,9 @@ TTX_SDA EQU 7 ;; variables ;; page 0 only TMP EQU H'0020' - +TTX_BYTE EQU H'0021' +TTX_CNT EQU H'0022' + ;; all pages W_TEMP EQU H'007E' STATUS_TEMP EQU H'007F' @@ -135,15 +137,17 @@ init movlw B'01000000' movwf INTCON + bsf PORTD,DTMF_PWRDWN bcf PORTD,TTX_RESET ;reset TTX nop nop bsf PORTD,TTX_RESET + bcf PORTD,TTX_SCL + bcf PORTD,TTX_SDA clrf TMR0 bsf INTCON,GIE - movlw .1 - movwf TMP + clrf TMP goto main ;; ------------------------------------- @@ -157,24 +161,44 @@ uart_rx_byte btfsc RCSTA,FERR goto uart_rx_fe movf RCREG,w ; TODO: move to input string - movwf TXREG - bsf TMP,0 + movwf TMP return uart_rx_fe movf RCREG,w return + + ;; ------------------------------------- +ttx_send_byte + movwf TTX_BYTE + movlw .8 + movwf TTX_CNT +ttx_next_bit + btfsc TTX_BYTE,7 + bsf PORTD,TTX_SDA + btfss TTX_BYTE,7 + bcf PORTD,TTX_SDA + bsf PORTD,TTX_SCL + bcf PORTD,TTX_SCL + rlf TTX_BYTE,f + decfsz TTX_CNT,f + goto ttx_next_bit + bcf PORTD,TTX_SDA + return ;; ------------------------------------- ;; MAINLOOP main - btfss TMP,0 + movf TMP,f + btfsc STATUS,Z goto main - bcf TMP,0 bcf PORTD,DTMF_PWRDWN bcf INTCON,T0IF clrf TMR0 + movf TMP,w + call ttx_send_byte + clrf TMP loop btfss INTCON,T0IF goto loop |