Exact match. Not showing close matches.
PICList
Thread
'[PIC]: '877 interrupts when disabled'
2000\09\25@080957
by
Carl Rouse
|
Sorry for the double post all, I forgot the [PIC] on the post....
I'm not currently running a watchdog, I didn't want it to mask any
problems that may occur (comments on this approach welcome), I've tried
disabling the Brownout detect bit, and I doubt EMI(though I will include a
little diagram of the switch buffering for all to look at.
switch circuit:
---Vcc
|
[10k]
|
o---|-------|---[1K]---PORTB, 6
| |
===0.1uF V 5V transorb
| ---
| |
o---|-------|---Gnd
hope this comes out,
notes on code:
I have two LEDs on PORTC, 4 and 5
two switches buffered as above on PORTB, 6 and 7
muxes for more I/O on PORTS A and C
this is stripped down code to try and isolate the problem,
with a lot of stuff added to the ISR to clock registers out the LEDs
(I use a DSO to catch the data)
code:
; This is to test the serial output of the PIC
list p=16f873
include "p16F873.inc"
; Constants
ESC equ 0x1b
ACK equ 0x06
CR equ 0x0d
SW1EN equ 0x00 ; PORT C
SW2EN equ 0x05 ; PORT A
SW3EN equ 0x02 ; PORT C
SW4EN equ 0x03 ; PORT C
SW_SEL1 equ 0x01 ; PORT A
SW_SEL2 equ 0x02 ; PORT A
SW_SEL3 equ 0x03 ; PORT A
SW_DATA equ 0x00 ; PORT A
;Variables *****************************************
delaycounter equ 0x20
delaycounter2 equ 0x21
delaycounter3 equ 0x22
delaycounter_ms equ 0x29
switch equ 0x25
setup_switch equ 0x26
dip_switch equ 0x27
denom equ 0x28
module_number_hi equ 0x30
module_number_lo equ 0x31
temp_w equ 0x23
temp_status equ 0x24
led_flasher equ 32
led_flasher2 equ 33
led_flasher3 equ 34
serial_buffer equ 0x40
ORG 0x000
clrf PCLATH
goto start__code
ORG 4
_interrupt
movwf temp_w
swapf STATUS, W
clrf STATUS
movwf temp_status
movlw A'I'
movlw B'00100000'
movf INTCON, W
movlw 0x50
bsf PORTC, 4
bsf PORTC, 5
; call delayWms
nop
nop
nop
bcf PORTC, 4
nop
nop
nop
bcf PORTC, 5
bsf PORTC, 4
btfsc PIE1, 0
bsf PORTC, 5
movlw 0x50
; call delayWms
nop
nop
nop
bcf PORTC, 4
nop
nop
nop
bcf PORTC, 5
bsf PORTC, 4
btfsc PIE1, 1
bsf PORTC, 5
movlw 0x50
; call delayWms
nop
nop
nop
bcf PORTC, 4
nop
nop
nop
bcf PORTC, 5
bsf PORTC, 4
btfsc PIE1, 2
bsf PORTC, 5
movlw 0x50
; call delayWms
nop
nop
nop
bcf PORTC, 4
nop
nop
nop
bcf PORTC, 5
bsf PORTC, 4
btfsc PIE1, 3
bsf PORTC, 5
movlw 0x50
; call delayWms
nop
nop
nop
bcf PORTC, 4
nop
nop
nop
bcf PORTC, 5
bsf PORTC, 4
btfsc PIE1, 4
bsf PORTC, 5
movlw 0x50
; call delayWms
nop
nop
nop
bcf PORTC, 4
nop
nop
nop
bcf PORTC, 5
bsf PORTC, 4
btfsc PIE1, 5
bsf PORTC, 5
movlw 0x50
; call delayWms
nop
nop
nop
bcf PORTC, 4
nop
nop
nop
bcf PORTC, 5
bsf PORTC, 4
btfsc PIE1, 6
bsf PORTC, 5
movlw 0x50
; call delayWms
nop
nop
nop
bcf PORTC, 4
nop
nop
nop
bcf PORTC, 5
bsf PORTC, 4
btfsc PIE1, 7
bsf PORTC, 5
movlw 0x50
; call delayWms
nop
nop
nop
bcf PORTC, 4
nop
nop
nop
bsf PORTC, 4
bsf PORTC, 5
movlw 0x50
; call delayWms
nop
nop
nop
nop
nop
nop
bcf PORTC, 5
; btfsc STATUS, Z
; bsf PORTC, 5
; xorwf PORTC, F
; clrf INTCON
; clrf PIR1
; clrf PIE1
; bsf PORTC, 5
; movwf TXREG
; banksel TXSTA
;tx_wait3
; btfss TXSTA, TRMT
; goto tx_wait3
; movlw 0x30
; movwf delaycounter
;tx_wait4
; decfsz delaycounter, F
; goto tx_wait4
; banksel TXREG
; bcf PORTC, 5 ; Disable CTS
; call tx_w
; movlw B'00010000'
; xorwf PORTC, 1
; bsf PORTC, 4
; btfsc PIR1, RCIF
; call rx_data
; clrf PIR1
bcf INTCON, T0IF ;clear interrupt flag
swapf temp_status, W
movwf STATUS
swapf temp_w, F
swapf temp_w, W
retfie
start__code
_main__code
initialisation
banksel TRISC
movlw B'00000001' ; init PORTA
movwf TRISA
movlw 0x06
movwf ADCON1
movlw 0xff ; init PORTB
movwf TRISB
movlw B'11000010' ; init PORTC
movwf TRISC
movlw 0x0a ; init Baud Rate 19200
movwf SPBRG
bsf TXSTA, CSRC
bsf TXSTA, TXEN
bsf TXSTA, BRGH
; movlw B'00100000' ; Enable RX interupt
; movwf PIE1
; bsf PIE1, RCIE
clrf PIE1
banksel RCSTA
bsf RCSTA, SPEN
bsf RCSTA, CREN
; bsf PORTC, 5 // Enable CTS
; movlw B'11001000'
; movwf INTCON
clrf INTCON
clrf PORTC
movf RCREG, W
movf RCREG, W
movlw B'00100000'
movwf PORTA
movlw B'00001101'
movwf PORTC
movlw serial_buffer
movwf FSR
label_0001
; movlw B'00010000'
; xorwf PORTC, F
; movlw 0x30
; call tx_w
; movlw 0xff
; call delayWms
btfss PORTB, 6
goto debounce_read
; movlw 0x31
; call tx_w
goto label_0001
debounce_read
clrf delaycounter
clrf delaycounter2
debounce_wait_read
decfsz delaycounter, F
goto debounce_wait_read
decfsz delaycounter2, F
goto debounce_wait_read
btfss PORTB, 6
goto read_mode
goto label_0001
read_mode
movlw B'00010000'
xorwf PORTC, F
; movlw 0x30
; call tx_w
movlw 0xff
call delayWms
; movlw 0x30
; call tx_w
goto label_0001
{Original Message removed}
More... (looser matching)
- Last day of these posts
- In 2000
, 2001 only
- Today
- New search...