diff options
author | Christian Pointner <equinox@mur.at> | 2012-06-07 17:17:36 +0000 |
---|---|---|
committer | Christian Pointner <equinox@mur.at> | 2012-06-07 17:17:36 +0000 |
commit | 48b5d88c8b24b569d605781f30c7cdd65e059367 (patch) | |
tree | 4f694ae1a4ef4fcaac3fb8cbb0684a0c90887e99 /software/idm/idm.asm | |
parent | cleanup (diff) |
tmr2 as 8kHz clock
git-svn-id: https://svn.spreadspace.org/mur.sat@508 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'software/idm/idm.asm')
-rw-r--r-- | software/idm/idm.asm | 79 |
1 files changed, 49 insertions, 30 deletions
diff --git a/software/idm/idm.asm b/software/idm/idm.asm index 7b39e9b..dfef5ce 100644 --- a/software/idm/idm.asm +++ b/software/idm/idm.asm @@ -42,8 +42,11 @@ C1m EQU .0 C2p EQU .1 AMP_OUT EQU .2 ADC_IN EQU .3 -CCP4 EQU .4 +SPEAKER EQU .4 +DBG1 EQU .6 +DBG2 EQU .7 ;; PortB +DBG0 EQU .0 SDI EQU .1 SDO EQU .2 INT EQU .3 @@ -74,10 +77,18 @@ OVERRUN EQU .1 ;; Interrupts org .4 movlb b'00000000' + btfsc PIR1,TMR2IF + goto int_tmr2 btfsc PIR1,SSP1IF goto int_spi retfie +int_tmr2 + bcf PIR1,TMR2IF + movlw b'01000000' + xorwf PORTA,f + retfie + int_spi bsf PORTA,7 bcf PIR1,SSP1IF @@ -203,7 +214,7 @@ init ;; BANK 3 movlb b'00000011' - clrf ANSELA + clrf ANSELA ; disable all analog inputs clrf ANSELB ;; BANK 2 @@ -211,55 +222,63 @@ init ;; BANK 1 movlb b'00000001' - movlw b'01111111' + movlw b'00101111' movwf TRISA - movlw b'01110011' + movlw b'01110010' movwf TRISB -; movlw b'01011000' ; 1 MHz -; movlw b'01100000' ; 2 MHz - movlw b'01101000' ; 4 MHz -; movlw b'01110000' ; 8 MHz -; movlw b'01111000' ; 16 MHz +; movlw b'01011000' ; 1 MHz +; movlw b'01100000' ; 2 MHz + movlw b'01101000' ; 4 MHz +; movlw b'01110000' ; 8 MHz +; movlw b'01111000' ; 16 MHz movwf OSCCON - movlw b'00001000' + movlw b'00001010' ; SSPIE,TMR2IE movwf PIE1 ;; BANK 0 movlb b'00000000' - clrf PIR1 - movlw b'11000000' + movlw .124 ; 8 kHz @ 4MHz + movwf PR2 + clrf TMR2 ; reset TMR2 + movlw b'00000100' ; Postscaler 1:1,Timer On,Prescaler 1:1 + movwf T2CON + clrf PIR1 ; reset all used interupt flags + movlw b'11000000' ; GIE,PEIE movwf INTCON bcf PORTA,FILTER_EN - bsf PORTB,INT + bcf PORTB,DBG0 + bcf PORTA,DBG1 + bcf PORTA,DBG2 + ;; ------------------------------------- ;; MAINLOOP main - movlw .255 - movwf CNT0 +;; movlw .255 +;; movwf CNT0 -outer1 - movlw .255 - movwf CNT1 +;; outer1 +;; movlw .255 +;; movwf CNT1 -outer - movlw .5 - movwf CNT2 +;; outer +;; movlw .5 +;; movwf CNT2 -inner - decfsz CNT2,f - goto inner +;; inner +;; decfsz CNT2,f +;; goto inner - decfsz CNT1,f - goto outer +;; decfsz CNT1,f +;; goto outer - decfsz CNT0,f - goto outer1 +;; decfsz CNT0,f +;; goto outer1 - movlw b'00001000' - xorwf PORTB,f +;; movlw b'00001000' +;; xorwf PORTB,f goto main |