INTCON (RB0/INT) and TRISB


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891

    Default INTCON (RB0/INT) and TRISB

    Hello,

    For my different tests, I usually use a button connected to RB0. I then check INTCON to trigger any action.

    To me, RB0 is an Input in this case (button).

    Why is it then possible to trigger the button's action even if TRISB.0 is set as Output?

    Do the "pull-ups" have any importance in this case? I made some tests but it doesn't make any change; the button still "works".
    Roger

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    What PIC are you using?

    Some PICBasic commands change the I/O state automatically for you (though I never rely on that)... post the test code you are using...

    As an aside, what is the picture of before the cheeses in your Switzerland advert? Exploding PIC? I knew there had to be something Hi-tech coming out of Switzerland apart from cookoo clocks...

  3. #3
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default

    Hello Melanie,

    I'm actually working with a 16F88.

    The test code (you may recall...) is for example this one:
    Code:
    OSCCON = %01100000          'Internal RC set to 4MHZ
    LED var PORTB.4
    MAIN:
         if INTCON.1 = 1 then    'If INTerrupt happens, then...
            pause 300               'Debounce button
            INTCON.1 = 0           'Reset INT flag
            TOGGLE LED
         endif
         goto MAIN
    end
    Swiss people are pacific; there would never be any explosion even if the led won't toggle after 10 hours trying... It is a small (about 2cm wide) flower named "Edelweiss" that you can mostly see in the alps. It means literally "precious white". The petals are made of a kind of white velvet and when, in the early morning hours of the day some water drops cover the petals and the sun rises, the flower is shining like it would be covered with diamonds. It's a german name and unlike, (i.e.) our city names, there is no french, italian, romanch or english (all national languages!!!) name for it.
    Attached Images Attached Images  
    Roger

  4. #4


    Did you find this post helpful? Yes | No

    Default

    I am using a 16F88 in a circuit and my header is this:

    OSCCON = $60 'set int osc to 4mhz
    ANSEL = 0 'SELECT ANALOG INPUTS 0 = NONE AND ALL DIGITAL
    ADCON0 = 0 'AD MODULE OFF & CONSUMES NO CURRENT
    CMCON = 7 'COMPARATORS OFF

    The PIC behaves perfectly.

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Looking the internal stuff at figure 5-8... it's sounds perfectly normal. It just monitor the I/O. No matter if set to input or output.

    You could also get an interrupt only by enabling/disabling the internall pull-up... depending of the external impedance

    So it's normal.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. clrf TRISB & 0x07F HELP..
    By chip_select in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 9th April 2008, 17:23
  2. How to set TMRO & TMR3 as Counter?.
    By NatureTech in forum mel PIC BASIC Pro
    Replies: 21
    Last Post: - 18th May 2007, 08:52
  3. Interrupts and Disable 16f877
    By Rob Martin in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 18th April 2005, 21:08

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts