Ich habe ein kurzes Testprogramm für den PIC24FV32KA302 geschrieben.
Alle LEDs an PROTB blinken außer die an RB4. Die Platine ist ok, der PIC
dürfte nicht kaputt sein, da zwei neue das gleich Problem habe.
Im DB steht zum PIN 11: SOSCI/AN15/U2RTS/CN1/RB4
Den sekundären Oszillator habe ich deaktiviert.
Die Analogfunktionen habe ich alle deaktiviert.
U2RTS sollte nicht das Problem sein, da RB9 (U1RTS) keine Probleme
macht.
Quellcode:
1
.equ __24FV32KA302, 1
2
.include "p24FV32KA302.inc"
3
config __FBS, BWRP_OFF ;Boot segment may be written
4
config __FGS, GWRP_OFF & GSS0_OFF ;General segment may be written, No Protection
config __FWDT, FWDTEN_OFF ;WDT disabled (control is placed on the SWDTEN bit)
8
9
10
.global __reset
11
.text
12
__reset:
13
;stack pointer init
14
mov #__SP_init,w15
15
mov #__SPLIM_init,W0
16
mov W0,_SPLIM
17
18
mov #0x00FF, w0
19
mov w0,TRISA ;set PORTA<0:7> as digital input
20
mov #0x0000, w0
21
mov w0,TRISB ;set PORTB<0:15> as digital output
22
mov #0x0000,w0
23
mov w0,LATB
24
clr ANSA ;All inputs on PORTA digital
25
clr ANSB ;All inputs on PORTB digital
26
27
28
bclr OSCCON,#SOSCEN ;Disables the secondary oscillator
29
30
;T1 init
31
bclr T1CON,#TCS ;Internal clock (FOSC/2)
32
bset T1CON,#TCKPS1
33
bset T1CON,#TCKPS0 ;Prescaler 1:256
34
bset T1CON,#TON ;Starts 16-bit Timer1
35
mov #31249,w0
36
mov w0,PR1 ;Peiod
37
;Init interrupt
38
bclr SR,#IPL2
39
bclr SR,#IPL2
40
bclr SR,#IPL2 ;CPU interrupt priority level is 0
41
bset IPC0,#T1IP2
42
bset IPC0,#T1IP1
43
bset IPC0,#T1IP0 ;Interrupt is Priority 7 (highest priority interrupt)
44
bclr IFS0,#T1IF ;Clear T1 interrupt flag
45
bset IEC0,#T1IE ;Enable T1 Interrupt
46
47
bra $
48
49
.global __T1Interrupt
50
__T1Interrupt:
51
bclr IFS0,#T1IF ; clear the interrupt flag
52
com LATB
53
retfie
54
55
.end
Gruß
Max
Edit:
Problem gelöst:
"bclr OSCCON,#SOSCEN" deaktiviert den sekundären Oszillator zu wenig.
Man muss ihn mit den config-bits "SOSCSRC" im Word "FOSCSEL"
deaktivieren.