diff options
author | Christian Pointner <equinox@mur.at> | 2011-07-24 21:28:10 +0000 |
---|---|---|
committer | Christian Pointner <equinox@mur.at> | 2011-07-24 21:28:10 +0000 |
commit | a192973dc55080e852101bc8f28ac29d23074790 (patch) | |
tree | 220d0fa5d344fdf7c8805b68768ad082eab48d0b /software/ihu/ihu.asm | |
parent | uart recv works (diff) |
first test for IHU,TTX communication
git-svn-id: https://svn.spreadspace.org/mur.sat@52 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'software/ihu/ihu.asm')
-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 |