summaryrefslogtreecommitdiff
path: root/software/idm/idm.asm
diff options
context:
space:
mode:
Diffstat (limited to 'software/idm/idm.asm')
-rw-r--r--software/idm/idm.asm47
1 files changed, 29 insertions, 18 deletions
diff --git a/software/idm/idm.asm b/software/idm/idm.asm
index cb4ffcd..d779b4b 100644
--- a/software/idm/idm.asm
+++ b/software/idm/idm.asm
@@ -138,6 +138,8 @@ endif
;; }
int_adc
bcf PIR1,ADIF
+ retfie
+
btfsc OVERRUN
retfie
;; movlb .1
@@ -182,6 +184,13 @@ int_spi
int_spi_0
btfss CMD_READ
retfie
+
+ incf TMP,f
+ movlb .4
+ movf TMP,w
+ movwf SSP1BUF
+ retfie
+
movlb .0
call rbuf_next
btfss UNDERRUN
@@ -190,17 +199,15 @@ int_spi_0
goto int_fsr_norestore
int_spi_0_loadnext
- movlb .4
+ movlb .4
movf INDFR,w
- ;; incf TMP,f
- ;; movf TMP,w
movwf SSP1BUF
goto int_fsr_norestore
int_spi_r
- movf INDFR,w
- btfss UNDERRUN
- ;; movf TMP,w
+ ;; movf INDFR,w
+ ;; btfss UNDERRUN
+ movf TMP,w
movwf SSP1BUF
clrf CMDS
bsf CMD_READ
@@ -330,9 +337,9 @@ init
movlb .4
movlw b'01000000' ; SMP=0,CKE=1
movwf SSP1STAT
- movlw b'00010000'
+ movlw b'00010000' ; BOEN=1
movwf SSP1CON3
- movlw b'00100100'
+ movlw b'00100100' ; SSPEN=1,CKP=0,SSPM=0100(SPI Slave with SS)
movwf SSP1CON1
if DEBUG == 1
bsf DBG0 ; Pull-up for DBG0
@@ -354,15 +361,14 @@ endif
movwf ADCON1
movlw b'00001101' ; AN3, ADC On
movwf ADCON0
- movlw b'01001000' ; ADIE,SSPIE
+ ;; movlw b'01001000' ; ADIE,SSPIE
+ movlw b'00001000' ; SSPIE
movwf PIE1
movlw b'01011111' ; Enable Pull UPs, disable T0CKI
movwf OPTION_REG
;; BANK 0
movlb .0
- movlw .124 ; 8 kHz @ 16MHz
- movwf PR2
clrf TMR1H ; reset TMR1
clrf TMR1L
movlw b'00100000' ; Source Fosc/4, Prescaler 1:4, LP-Osc off, Sync, Timer off
@@ -376,6 +382,7 @@ endif
bsf INT
call buf_init
clrf CMDS
+
clrf TMP
bsf INTCON,GIE
@@ -386,15 +393,19 @@ main
if DEBUG == 1
bcf SPEAKER
btfss DBG0
- goto enable_t1
+ bcf INT
+ btfsc DBG0
+ bsf INT
- btfsc T1CON,TMR1ON
- bcf T1CON,TMR1ON
- goto main
+;; goto enable_t1
+
+;; btfsc T1CON,TMR1ON
+;; bcf T1CON,TMR1ON
+;; goto main
-enable_t1
- btfss T1CON,TMR1ON
- bsf T1CON,TMR1ON
+;; enable_t1
+;; btfss T1CON,TMR1ON
+;; bsf T1CON,TMR1ON
endif
btfss CS
goto main