Searching \ for '[PIC]: Interrupt RB0/INT' 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: 'Interrupt RB0/INT'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Interrupt RB0/INT'
2001\03\08@103351 by pang khong lin

picon face
Hi,

I need some help with some simple assembly. The code are provided below. My
questions are -

1.   I connect the pin RB1 directly to a LED and the RBO/INT to the ground.
I then switch on the power.
The LED does not light up until the RB0/INT pin is switch to Vcc ( interrupt
occurs ). This is correct.
Now, I switch the RB0/INT back to ground and reset the power supply. The
moment i reconnect the
supply, the LED lights up eventhough no interrupt occurs. Why is that so?
I found that if i disconnect the supply for a longer period of time, then
the operation is correct.
Does it have something to do with discharging?

2.   I configure RBO/INT as an interrupt pin and found that when i connect
this pin to an LED, it lights up.
I use a meter to measure the output voltage of the pin and it produce a
reading of 1.5V - 2.0V.
Why is this so? Is there a need to put some form of buffers or diodes on the
respective input/output
lines?

Can anyone provide some advice on interfacing the i/o pins of PIC with other
analog/digital circuits?

Thanks for any advice.

       org     0
       goto    MAIN

       org     4       ; Interrupt Service Routine
       goto    INTSER

MAIN    bank1
       movlw   B'00000000'
       movwf   TRISA
       movlw   B'00011101'
       movwf   TRISB
       bank0
       clrf    PORTA
       clrf    PORTB
       bank1
       bcf     OPTREG,RBPU
       bsf     OPTREG,INTEDG
       bcf     INTCON,INTF
       bsf     INTCON,INTE
       bsf     INTCON,GIE
LOOP    sleep                   ; let IRQ wake it up and determine functions
       nop
       nop
       nop
       goto    LOOP

; Only RB0/INT is considered, other interrupts are disabled.

INTSER  movwf   w_temp
       swapf   STATUS,W
       movwf   status_temp
       bcf     INTCON,INTF
       bank0
       bsf     PORTB,1         ;bring the phone off hook
ENDINT  swapf   status_temp,W
       movwf   STATUS
       swapf   w_temp,F
       swapf   w_temp,W
       retfie

END
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.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\03\08@104026 by Peter Betts

picon face
> I found that if i disconnect the supply for a longer period
> of time, then
> the operation is correct.
> Does it have something to do with discharging?

See archive posts regarding POR (Power On Reset), this was discussing the
exact problem you have.

{Quote hidden}

Could you have selected the internal pull up resistors on PORTB pins?


> Can anyone provide some advice on interfacing the i/o pins of
> PIC with other
> analog/digital circuits?

With what other circuits? Do you have a specific query?

Pete

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


2001\03\08@111311 by Drew Vassallo

picon face
>I found that if i disconnect the supply for a longer period of time, then
>the operation is correct.
>Does it have something to do with discharging?

Check the datasheets for "Brownout circuit protection".  This should solve
99% of your problem.

>2.   I configure RBO/INT as an interrupt pin and found that when i connect
>this pin to an LED, it lights up.

I don't get it.  If you define RB0 as an interrupt source, it's an INPUT,
not an output.  How does it light up the LED?  It may be because of your
input source, which is somehow dividing down, which might explain the odd
voltage levels.

--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\03\09@044829 by Clive Frederickson

flavicon
face
Hi Pang

Some suggestions below, Hope they are of use. Happy Pic-ing

Regards

Clive Frederickson
R&D Technician (CECF Group)

       ----------
       From:  pang khong lin [SMTP:spam_OUTklpangTakeThisOuTspamHOTMAIL.COM]
       Sent:  08 March 2001 15:34
       Subject:  [PIC]: Interrupt RB0/INT

       Hi,

       I need some help with some simple assembly. The code are provided
below. My
       questions are -

       1.   I connect the pin RB1 directly to a LED and the RBO/INT to the
ground.
       I then switch on the power.
       The LED does not light up until the RB0/INT pin is switch to Vcc (
interrupt
       occurs ). This is correct.

       Now, I switch the RB0/INT back to ground and reset the power supply.
The
       moment i reconnect the
       supply, the LED lights up eventhough no interrupt occurs. Why is
that so?
       I found that if i disconnect the supply for a longer period of time,
then
       the operation is correct.

       Does it have something to do with discharging?
        Yes. Until the supply has drop to near 0v the RAM in the PIC will
be maintained. So te Bit you set in PORTB register remains set, And the PIC
sit's in SLEEP mode until an interrupt occurs which will only set the
already set bit.

       Fix = Tie a Pull-up resistor from the MCLR pin to supply (~4.7K to
10K) And a momentary switch from MCLR to 0v. Then press it to reset the pic.
Your start up code will reset PORTB.

       Also, Use a push button to trigger your interrupt, Its easier than a
wire link. Either by 1) A pull up resistor and a switch to 0v. or 2) A pull
down resistor ~4.7K (RB0 to 0v) and a switch to a 100ohm resistor to supply.

       2.   I configure RBO/INT as an interrupt pin and found that when i
connect
       this pin to an LED, it lights up.
       I use a meter to measure the output voltage of the pin and it
produce a
       reading of 1.5V - 2.0V.
       Why is this so? Is there a need to put some form of buffers or
diodes on the
       respective input/output
       lines?

       Although RB0 is setup as an input (Tri-state = High impeadence) You
have enabled the week pull up's. These will source enough current to
light-up your LED.

       Can anyone provide some advice on interfacing the i/o pins of PIC
with other
       analog/digital circuits?

       Best to read up some tutorials / intro's to the PIC. Farnel have
some in the catalogue (if you can get it, Try http://www.farnell.co.uk
<http://www.farnell.co.uk> ) or search the web. I think Nigel Goodwin has a
web site with info and links to other pic web sites.
(It's all I can recall from my little brain right now)

       Thanks for any advice.

               org     0
               goto    MAIN

               org     4       ; Interrupt Service Routine
               goto    INTSER

       MAIN    bank1
               movlw   B'00000000'
               movwf   TRISA
               movlw   B'00011101'
               movwf   TRISB
               bank0
               clrf    PORTA
               clrf    PORTB
               bank1
               bcf     OPTREG,RBPU
               bsf     OPTREG,INTEDG
               bcf     INTCON,INTF
               bsf     INTCON,INTE
               bsf     INTCON,GIE

       LOOP    sleep                   ; let IRQ wake it up and determine
functions
               nop
               nop
               nop
               goto    LOOP

       ; Only RB0/INT is considered, other interrupts are disabled.

       INTSER  movwf   w_temp
               swapf   STATUS,W
               movwf   status_temp
               bcf     INTCON,INTF
               bank0
               bsf     PORTB,1         ;bring the phone off hook
       ENDINT  swapf   status_temp,W
               movwf   STATUS
               swapf   w_temp,F
               swapf   w_temp,W
               retfie

       END

_________________________________________________________________________
       Get Your Private, Free E-mail from MSN Hotmail at
http://www.hotmail.com.


*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Dyson's Contrarotator(TM) is the first washing machine with 2
drums rotating in opposite directions at once. This means it
gives the cleanest wash results in the fastest time and takes
the largest loads. The Contrarotator(TM) is now on sale at
selected retailers, and will be available nationwide in spring 2001.

For more information,
please visit our website at http://www.dyson.com.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\03\10@010226 by pang khong lin

picon face
{Quote hidden}

Hi everyone,

I am not very clear here. Isn't a Power On Reset is also a Reset? Which will
then initialise the Program Counter and allow the MAIN portion to run? If
the statements in MAIN is run, then isn't PORTB is being initialise and
cleared before it goes to sleep and wait for the INT?

Just to let you know, i switch off the supply for more than 2-3 min and the
operation is still incorrect. Does it really takes that long for the RAM to
lose charge?

At the moment, what i did was that i reverse the logic and output a low when
an INT occurs. This will remove the uncertainty.

>
>Also, Use a push button to trigger your interrupt, Its easier than a
>wire link. Either by 1) A pull up resistor and a switch to 0v. or 2) >A
>pull down resistor ~4.7K (RB0 to 0v) and a switch to a 100ohm >resistor to
>supply.

I will try this instead of reseting my supply. Thanks for the advice.

{Quote hidden}

So is it normal to put diodes on i/o pins which are bidirectional? Opps, the
drop in voltage....

{Quote hidden}

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\03\10@010226 by pang khong lin

picon face
{Quote hidden}

Hi everyone,

I am not very clear here. Isn't a Power On Reset is also a Reset? Which will
then initialise the Program Counter and allow the MAIN portion to run? If
the statements in MAIN is run, then isn't PORTB is being initialise and
cleared before it goes to sleep and wait for the INT?

Just to let you know, i switch off the supply for more than 2-3 min and the
operation is still incorrect. Does it really takes that long for the RAM to
lose charge?

At the moment, what i did was that i reverse the logic and output a low when
an INT occurs. This will remove the uncertainty.

>
>Also, Use a push button to trigger your interrupt, Its easier than a
>wire link. Either by 1) A pull up resistor and a switch to 0v. or 2) >A
>pull down resistor ~4.7K (RB0 to 0v) and a switch to a 100ohm >resistor to
>supply.

I will try this instead of reseting my supply. Thanks for the advice.

{Quote hidden}

So is it normal to put diodes on i/o pins which are bidirectional? Opps, the
drop in voltage....

{Quote hidden}

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\03\11@140017 by pang khong lin

picon face
Hi, i hope someone could help me out with this code. This is a simple code
with a very short main portion and a Interrupt Service Routine. What i do
not understand is that i can only trigger the interrupt once , when i try to
trigger it again, there seems to be no response.
( The ISR is suppose to bring the phone off hook, delay for 2 seconds and
then put it on hook again ) The program does not responds to any more
interrupt other than the first. Can anyone spot anything wrong?

Also, i heed Clive Frederickson advice to add a pullup resistor and a switch
to the /MCLR pin. From what i have read the /MCLR pin will cause a reset and
will put the PC back to 0000. But unfortunately that does not happens in my
case. My PIC is powered from a battery, whenever i connect the supply
manually, there will be funny signal from the io pins. ( I understand that
this is cause by the slow rise time )Even after resetting it through /MCLR,
the error still persists. The most frustrating part is that it happens
intermmitently. So what is wrong? I was thinking even if the battery has a
low rise time, the /MCLR will correct all these right?

Thanks.

       org     0
       goto    MAIN

       org     4       ; Interrupt Service Routine
       goto    INTSER

MAIN    bank1
       movlw   B'00000000'
       movwf   TRISA
       movlw   B'00000101'
       movwf   TRISB
       bank0
       clrf    PORTA
       clrf    PORTB
       bsf     PORTB,RELAY
       bank1
       bcf     OPTREG,RBPU
       bsf     OPTREG,INTEDG
       bcf     INTCON,INTF
       bsf     INTCON,INTE
       bsf     INTCON,GIE
LOOP    SLEEP           ; let IRQ wake it up and determine functions
       nop
       nop
       nop
       goto    LOOP

; Only RB0/INT is considered, other interrupts are disabled.

INTSER  movwf   w_temp
       swapf   STATUS,W
       movwf   status_temp
       bcf     INTCON,INTF
       bank0
       bcf     PORTB,RELAY     ; bring the phone off hook
       call    DELAY
       bsf     PORTB,RELAY     ; bring the phone on hook
ENDINT  swapf   status_temp,W
       movwf   STATUS
       swapf   w_temp,F
       swapf   w_temp,W
       retfie

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spamBeGonelistservspamBeGonespammitvma.mit.edu with SET PICList DIGEST in the body


2001\03\11@173648 by David Duffy

flavicon
face
pang khong lin wrote:
>Hi, i hope someone could help me out with this code. This is a simple code
>with a very short main portion and a Interrupt Service Routine. What i do
>not understand is that i can only trigger the interrupt once , when i try to
>trigger it again, there seems to be no response.
>( The ISR is suppose to bring the phone off hook, delay for 2 seconds and
>then put it on hook again ) The program does not responds to any more
>interrupt other than the first. Can anyone spot anything wrong?
>
>Also, i heed Clive Frederickson advice to add a pullup resistor and a switch
>to the /MCLR pin. From what i have read the /MCLR pin will cause a reset and
>will put the PC back to 0000. But unfortunately that does not happens in my
>case. My PIC is powered from a battery, whenever i connect the supply
>manually, there will be funny signal from the io pins. ( I understand that
>this is cause by the slow rise time )Even after resetting it through /MCLR,
>the error still persists. The most frustrating part is that it happens
>intermmitently. So what is wrong? I was thinking even if the battery has a
>low rise time, the /MCLR will correct all these right?

The code looks ok at a quick glance - more comments would be nice.
What is the battery voltage? Are you using a regulator?
How are you driving the relay - via a transistor?
Do you have a diode across the relay to kill the back emf spike?
Regards...

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email TakeThisOuTlistservEraseMEspamspam_OUTmitvma.mit.edu with SET PICList DIGEST in the body


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