Strange electrical behavior with PIC16F684


Closed Thread
Results 1 to 11 of 11
  1. #1
    xnihilo's Avatar
    xnihilo Guest

    Red face Strange electrical behavior with PIC16F684

    I'm using the following connexions for pic16F684. It is connected to a 8*2 LCD display.
    Power supply is 9V duracell with 5V L7805 voltage regulator.

    VDD: +5V
    VSS: 0V
    There is a ceramic disk 0.1 UF capacitor between VSS and VDD pins.

    I enabled PORTA on-change interrupts because I need to monitor for a 5V pulse on RA5 which is default low (I disabled WPU and set the port as output and set PORTA.5=0)

    RA0: nothing connected, output, WPU disabled
    RA1: nothing connected, output, WPU disabled
    RA2: nothing connected, output, WPU disabled
    RA3: nothing connected, with an external 10k weakPU between the pin and +5V, INT enabled
    RA4: nothing connected, internal WPU enabled, INT enabled
    RA5: nothing connected, WPU DISABLED, INT enabled

    RC0: lcd data bit 4
    RC1: lcd data bit 5
    RC2: lcd data bit 6
    RC3: lcd data bit 7
    RC4: with an external 10k weakPU between the pin and +5V, LCD R/S bit
    RC5: LCD Enable bit

    When I touch any pin, an int is triggered on portA.5 (RA5).

    WHY???

  2. #2
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default Weak pullups can be really weak

    Hi,

    Try using a pullup 2.7K resistor on the PIN.

    While touching the pin you may induce quite a few volts(k) so perhaps it is not a good practice. PICs are sensitive to esd which may kill them.
    Regards

    Sougata

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


    Did you find this post helpful? Yes | No

    Default

    No pull-up or WPU... the i/o is set as an output and set to low and AN INT happen???? huh???? I must miss something here!

    Maybe i'm blind... but i don't see any cod in here... so i would assume the TRIS register haven't been changed. Try LOW PORTA.5 instead.. if this work.. it just mean you didn't at least changed TRISA setting....or the INT don't care about the TRIS... i'll check the datasheet...
    Steve

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

  4. #4
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by sougata View Post
    Hi,

    Try using a pullup 2.7K resistor on the PIN.

    While touching the pin you may induce quite a few volts(k) so perhaps it is not a good practice. PICs are sensitive to esd which may kill them.
    I can't use a WPU because I want this pin LOW by default.

    Huh... Yes, I know about ESD, I should be more careful. Anyway PICs are pretty tough.

  5. #5
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    No pull-up or WPU... the i/o is set as an output and set to low and AN INT happen???? huh???? I must miss something here!
    Yes an int happens... No clue why it happens.

    Maybe i'm blind... but i don't see any cod in here... so i would assume the TRIS register haven't been changed. Try LOW PORTA.5 instead.. if this work.. it just mean you didn't at least changed TRISA setting....or the INT don't care about the TRIS... i'll check the datasheet...
    I didn't put any code here but beleive me,

    TRIS is set as 0 (output) for RA5 and I used PORTA.5 = 0 to be sure it has been set LOW.

    I beleive the pin should be low and an int should be triggered when I apply +5V on the pin to set it logicaly HIGH but that's not what's happening.
    And an int happens for this pin even in I touch another pin or even the GND heatsink of the L7805 voltage regulator or +5V or GND...

    I checked the connexions on the breadboard and everything looks fine...
    Very frustrating.

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


    Did you find this post helpful? Yes | No

    Default

    obviously, there's something else... great news i have over 500 of those in stock

    i'll try a simple snippet and see what happen. I would guess the interrupt will happen 'cause it's feeded in a X way inside. Probably you will need to disable the interrupt as well...

    let's see what will happen on my side in a few minutes.. gimme 1/2 hour + couple of RedBull+Amaretto (even if i shouldn't... don't tell to my doctor )... or so.
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    unable to reproduce the problem here...

    post your code.
    Steve

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

  8. #8
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default Code please to detect PORTA.5 INT

    Quote Originally Posted by xnihilo View Post
    When I touch any pin, an int is triggered on portA.5 (RA5).

    WHY???
    Hi,

    Is your PORTA.5 changing all the time. Please note that the latch that holds the value for a mismatch is not cleared upon MCLR reset. Thus depending on your code there may be a condition where your PIC resets and you don't realize. (If you are manually polling values)

    Please post your complete code and schematic.
    Regards

    Sougata

  9. #9
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Smile

    Quote Originally Posted by mister_e View Post
    obviously, there's something else... great news i have over 500 of those in stock

    i'll try a simple snippet and see what happen. I would guess the interrupt will happen 'cause it's feeded in a X way inside. Probably you will need to disable the interrupt as well...

    let's see what will happen on my side in a few minutes.. gimme 1/2 hour + couple of RedBull+Amaretto (even if i shouldn't... don't tell to my doctor or so.
    Redbull + Amareto... Thats GEEK stuff

  10. #10
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    unable to reproduce the problem here...

    post your code.
    You don't have exactly the same components and connexion

    How can I discover the source of the problem... I will have to rebuild a clone of the system but this time not on a breadboard.

  11. #11
    xnihilo's Avatar
    xnihilo Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by sougata View Post
    Hi,

    Is your PORTA.5 changing all the time. Please note that the latch that holds the value for a mismatch is not cleared upon MCLR reset. Thus depending on your code there may be a condition where your PIC resets and you don't realize. (If you are manually polling values)

    Please post your complete code and schematic.
    Okay, I will draw the schematics today.
    The code is huge (I fill all the 2048 words program space!!).

    PortA does not change all the time. It is set as output and set to LOW, there is no reason why it should change.
    When an interrupt occurs, the int handler takes care of reading porta to refresh the latch so there should be no mismatch.

Similar Threads

  1. GPS $GPRMC to PIC16F684. Need help with SERIN2
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 27th November 2009, 09:47
  2. Strange pic 16f877a memory loss
    By DavyJones in forum General
    Replies: 23
    Last Post: - 6th July 2009, 20:27
  3. Electrical Current Does Prevent Corrosion?
    By T.Jackson in forum Off Topic
    Replies: 13
    Last Post: - 18th March 2008, 13:13
  4. PIC16F684 + LCD to use the 256bytes of EEPROM - HELP
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th March 2008, 14:19
  5. Strange ASM file
    By barkerben in forum General
    Replies: 2
    Last Post: - 29th November 2004, 18:54

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