summaryrefslogtreecommitdiff
path: root/software/idm/idm.asm
diff options
context:
space:
mode:
authorChristian Pointner <equinox@mur.at>2012-06-07 18:25:14 +0000
committerChristian Pointner <equinox@mur.at>2012-06-07 18:25:14 +0000
commitaef9660e5be2b63608e03770e026e1012ff47a4a (patch)
tree18ec11794e1076eb6eabea25b07ae5b9f5c09063 /software/idm/idm.asm
parentimproved port pin assigments (diff)
added ad conversion
git-svn-id: https://svn.spreadspace.org/mur.sat@513 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'software/idm/idm.asm')
-rw-r--r--software/idm/idm.asm32
1 files changed, 22 insertions, 10 deletions
diff --git a/software/idm/idm.asm b/software/idm/idm.asm
index ca1233e..03daa6d 100644
--- a/software/idm/idm.asm
+++ b/software/idm/idm.asm
@@ -85,12 +85,20 @@ OVERRUN EQU .1
int_tmr2
bcf PIR1,TMR2IF
- movlw b'01000000'
- xorwf PORTA,f
+ movlb b'00000001'
+ bsf ADCON0,GO
+ call wbuf_next
+ btfsc FLAGS,OVERRUN
+ retfie
+int_tmr2_adcon
+ btfsc ADCON0,GO
+ goto int_tmr2_adcon
+ movf ADRESH,w
+ movwf INDF0
retfie
+
int_spi
- bsf DBG2
bcf PIR1,SSP1IF
movlb b'00000100'
movf SSP1BUF,w
@@ -98,7 +106,6 @@ int_spi
movf TMP,w
movwf SSP1BUF
movlb b'00000000'
- bcf DBG2
retfie
;; -------------------------------------
@@ -214,7 +221,8 @@ init
;; BANK 3
movlb b'00000011'
- clrf ANSELA ; disable all analog inputs
+ movlw b'00001111' ; PORTA0:3 analog, PORTA4:7, digital
+ movwf ANSELA ; PORTB0:7 digital
clrf ANSELB
;; BANK 2
@@ -228,19 +236,23 @@ init
movwf TRISB
; movlw b'01011000' ; 1 MHz
; movlw b'01100000' ; 2 MHz
- movlw b'01101000' ; 4 MHz
+; movlw b'01101000' ; 4 MHz
; movlw b'01110000' ; 8 MHz
-; movlw b'01111000' ; 16 MHz
+ movlw b'01111000' ; 16 MHz
movwf OSCCON
+ movlw b'01010000' ; Left Justified, FOSC/16, NEG=VSS,POS=VDD
+ movwf ADCON1
+ movlw b'00001101' ; AN3, ADC On
+ movwf ADCON0
movlw b'00001010' ; SSPIE,TMR2IE
movwf PIE1
-
+
;; BANK 0
movlb b'00000000'
- movlw .124 ; 8 kHz @ 4MHz
+ movlw .124 ; 8 kHz @ 16MHz
movwf PR2
clrf TMR2 ; reset TMR2
- movlw b'00000100' ; Postscaler 1:1,Timer On,Prescaler 1:1
+ movlw b'00000101' ; Postscaler 1:1,Timer On,Prescaler 1:4
movwf T2CON
clrf PIR1 ; reset all used interupt flags
movlw b'11000000' ; GIE,PEIE