diff options
Diffstat (limited to 'software')
-rw-r--r-- | software/ihu/ihu.asm | 86 | ||||
-rw-r--r-- | software/pic.include.mk | 6 |
2 files changed, 69 insertions, 23 deletions
diff --git a/software/ihu/ihu.asm b/software/ihu/ihu.asm index dce1fa7..5258dfc 100644 --- a/software/ihu/ihu.asm +++ b/software/ihu/ihu.asm @@ -40,25 +40,29 @@ ;; constants ;; I/O Pins -DTMF_D0 EQU 0 -DTMF_D1 EQU 1 -DTMF_D2 EQU 2 -DTMF_D3 EQU 3 -DTMF_PWRDWN EQU 4 -TTX_RESET EQU 5 -TTX_SCL EQU 6 -TTX_SDA EQU 7 +DTMF_D0 EQU 0 +DTMF_D1 EQU 1 +DTMF_D2 EQU 2 +DTMF_D3 EQU 3 +DTMF_PWRDWN EQU 4 +TTX_RESET EQU 5 +TTX_SCL EQU 6 +TTX_SDA EQU 7 ;; variables ;; page 0 only -TMP EQU H'0020' -TTX_BYTE EQU H'0021' -TTX_CNT EQU H'0022' -WAIT_CNT EQU H'0023' +TMP EQU H'0020' +TTX_BYTE EQU H'0021' +TTX_BIT_CNT EQU H'0022' +TTX_BYTE_CNT EQU H'0023' +WAIT_CNT EQU H'0024' + +BUF EQU H'0040' +BUF_END EQU H'004F' ;; all pages -W_TEMP EQU H'007E' -STATUS_TEMP EQU H'007F' +W_TEMP EQU H'007E' +STATUS_TEMP EQU H'007F' ;; bits @@ -185,13 +189,12 @@ uart_rx_fe ;; ------------------------------------- ttx_send_byte + bsf STATUS,RP0 + bcf TRISD,TTX_SDA + bcf STATUS,RP0 movwf TTX_BYTE - bsf PORTD,TTX_SCL - movlw .3 - bcf PORTD,TTX_SCL - call wait_ms movlw .8 - movwf TTX_CNT + movwf TTX_BIT_CNT ttx_next_bit btfsc TTX_BYTE,7 bsf PORTD,TTX_SDA @@ -207,11 +210,46 @@ ttx_next_bit nop nop rlf TTX_BYTE,f - decfsz TTX_CNT,f + decfsz TTX_BIT_CNT,f goto ttx_next_bit - bcf PORTD,TTX_SDA + bsf STATUS,RP0 + bsf TRISD,TTX_SDA + bcf STATUS,RP0 return + + ;; ------------------------------------- +ttx_send_frame + movwf TTX_BYTE + andlw b'00001111' + movwf TTX_BYTE_CNT + bsf PORTD,TTX_SCL + movlw .3 + bcf PORTD,TTX_SCL + call wait_ms + + movf TTX_BYTE,w + call ttx_send_byte + + movf TTX_BYTE_CNT,f + btfsc STATUS,Z + return + +ttx_next_byte + movlw .16 + movwf TTX_BIT_CNT +ttx_wait_octet + decfsz TTX_BIT_CNT,f + goto ttx_wait_octet + + movf INDF,w + call ttx_send_byte + + incf FSR,f + decfsz TTX_BYTE_CNT,f + goto ttx_next_byte + return + ;; ------------------------------------- ;; MAINLOOP main @@ -219,8 +257,10 @@ main btfsc STATUS,Z goto main - movf TMP,w - call ttx_send_byte + movlw BUF + movwf FSR + movlw b'00010000' + call ttx_send_frame clrf TMP goto main diff --git a/software/pic.include.mk b/software/pic.include.mk index 38a4755..90d54db 100644 --- a/software/pic.include.mk +++ b/software/pic.include.mk @@ -51,6 +51,12 @@ clean: rm -f $(HEXFILE) program: $(HEXFILE) + @$(PROG) --stop + @$(PROG) -p $(PROC_TYPE) -e + @$(PROG) -p $(PROC_TYPE) -s -w -f $(HEXFILE) + @$(PROG) -p $(PROC_TYPE) -s -v -f $(HEXFILE) + +write: $(HEXFILE) @$(PROG) -p $(PROC_TYPE) -s -w -f $(HEXFILE) verify: $(HEXFILE) |