Searching \ for '[PIC]: 16F877 RB Interrupt on Change' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ints.htm?key=interrupt
Search entire site for: '16F877 RB Interrupt on Change'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: 16F877 RB Interrupt on Change'
2001\01\12@050701 by Andrew Quinn

flavicon
face
Port B Interrupt on change has really got me stumped. I have looked
everywhere and can't find anything that explains why I can't get the
following test code to work. I can only assume that the interrupt doesn't
happen because RD3 is never set when I toggle any of the RD4:7 lines.

If anyone can shed any light on this it would be most appreciated?

Regards.... Andrew

list p=16f877

; Include file, change directory if needed

include "p16f877.inc"

ORG 0x0000

NOP

CLRF STATUS

CLRF PCLATH

GOTO START

ORG 0x0004

BSF PORTD,3

BTFSC PORTB,7

GOTO $-1

MOVF PORTB,W

BCF INTCON,RBIF

RETFIE

START BSF STATUS,RP0

BSF OPTION_REG,7

MOVLW B'11110000'

MOVWF TRISB

MOVLW B'00000000'

MOVWF TRISD

MOVWF TRISE

BCF STATUS,RP0

CLRF PORTB

CLRF PORTD

BSF PORTD,2

CLRF INTCON

BSF INTCON,GIE

BSF INTCON,INTE

BSF INTCON,RBIE

HERE GOTO HERE

END

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\01\12@062238 by Vasile Surducan

flavicon
face
Do you have a keypad or buttons between Rd4:7 and Rb4:7 ?
You must enable pull-up resistor on Rb or to put aditional external
resistence to Vcc.
The folowing routine was written for jal but is almost in asm.
It reads the Rb7 -variable usa and Rb6 -variable apa
and detect low to high transition on this pins.
Check also the AN566

procedure interrupt_on_change is
 pragma interrupt
 assembler
   local loop, usa_p, apa_p, out n
          movwf  w_temp        -- save
          swapf  status, w
          movwf  status_temp
   loop:  bcf    intcon_gie    -- disable all interrupts
          btfsc  intcon_gie    -- be sure
          goto   loop
          btfss  intcon_rbif   -- test if interrupt
          goto   out           -- if not go out from isr
          btfsc  usa           -- if yes test which pin
          goto   usa_p
          btfsc  apa
          goto   apa_p
          goto   out
   apa_p:

          bcf    intcon_rbie   -- disable irq on change
          bsf    apa_flag
          goto   out
   usa_p:

          bcf    intcon_rbie
          bsf    usa_flag
    out:
          bcf    intcon_rbif   -- else prepare for next interrupt

          swapf status_temp, w -- restore
          movwf status
          swapf w_temp, f
          swapf w_temp, w
          retfie
  end assembler
end procedure



On Fri, 12 Jan 2001, Andrew Quinn wrote:

{Quote hidden}

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\01\12@093310 by Olin Lathrop

face picon face
> I can only assume that the interrupt doesn't
> happen because RD3 is never set when I toggle any of the RD4:7 lines.

Interrupt on change uses the high 4 bits of port B, not port D.


*****************************************************************
Olin Lathrop, embedded systems consultant in Devens Massachusetts
(978) 772-3129, spam_OUTolinTakeThisOuTspamembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\01\12@110256 by Drew Vassallo

picon face
>Port B Interrupt on change has really got me stumped. I have looked
>everywhere and can't find anything that explains why I can't get the
>following test code to work. I can only assume that the interrupt doesn't
>happen because RD3 is never set when I toggle any of the RD4:7 lines.

Is this just a typo, or are you really trying to toggle PORTD lines instead
of PORTB?

Are you sure RD3 isn't open collector?  I don't have the datasheet for the
'877.

--Andrew
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\01\12@161332 by Andrew Quinn

flavicon
face
It was a typo... sorry.  I am definitely toggling Port B and no RD3 is not
an open collector.  Only RA4 on the 16F877.

Regards.... Andrew

{Original Message removed}

More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...