I can't read some input pins on a PIC18F4620


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2011
    Posts
    4

    Default I can't read some input pins on a PIC18F4620

    Please help me!
    I cannot get my pic to read pins RB.0 or RB.1 or RB.2.

    I want to trigger an interrupt on a PIC18F4620, by sending a pulse to INT0 from another pic. I couldn’t get it to work, so I made a test program to pulse on and off, also lighting a led on the sending pic, and lighting a led on the receiving pic if the change on the input pin is detected. If I send the pulse to RC.0, it works fine (variable abSend), but if I send the pulse to RB.0, RB.1 or RB.2 (variables picBint0, picBint1, picBint2) it does not seem to be reading the pins. If I touch a led connected through a resistor to the inputs, it flashes on and off, so I know the signal is getting to the pins.

    I have tried replacing the pic (3 times, using anti-static precautions), replacing capacitors, disconnecting other parts of the circuit, connecting 10K pull-up resistors on unused input pins, and writing my code different ways. I think that if my code were bad, then it wouldn’t work on RC.0. I just comment out the lines for the pins that I am not testing (on sending and receiving pic), not changing any of the other code. Same result each time: works great on RC.0, and doesn’t work for RB.0, RB.1 or RB.2. I am doing this test with interrupts turned off.
    I am totally stumped. Can someone please help me?

    I have attached my circuit diagram.

    Here is my relevant code:
    TRISA = %11111111
    TRISB = %11111111
    TRISC = %00000001
    TRISD = %00000110
    TRISE = %11111111
    INTCON = %00000000 'intcon.7 = 0 disables global interrupts
    INTCON2 = %00010101
    INTCON3 = %11010000
    RCON.7 = 0 '0 = Disable priority levels on interrupts
    PIE1.6 = 0 '0 = Disables the A/D interrupt
    TestInt:
    if picBint0 = 0 then 'this doesn't work
    'if picBint1 = 0 then 'this doesn't work
    'if picBint2 = 0 then 'this doesn't work
    'if abSend = 0 then 'this works fine
    testLed = 1
    else
    testLed = 0
    endif
    goto TestInt

    Thank you very much!

    Vic Chaney
    Attached Images Attached Images

  2. #2
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: I can't read some input pins on a PIC18F4620

    It looks like RB0, RB1 and RB2 can have analog inputs where RC0 does not. I don't see in your program where you turn the analog functions off. This is only after a quick read of your program and the data sheet. Try turning them off first and if there is a setting to make them digital inputs, I'd try doing that also.

  3. #3
    Join Date
    Oct 2011
    Posts
    4


    Did you find this post helpful? Yes | No

    Default Re: I can't read some input pins on a PIC18F4620

    That did it! My problem is solved!

    Thank you so much. Your reply has ended a long period of aggravation, trying to figure this out.

    I used a PIC18F252 for a similar purpose to what I am doing now, and it did not need this (probably due to a less robust set of A/D functions).

    There are only a few small spots in the datasheet that cover this.

    Thank you again!

    Vic

  4. #4
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: I can't read some input pins on a PIC18F4620

    Miracles do happen! I got something right! Please don't tell boss or wife.

Similar Threads

  1. Input Pins – Low Impedance
    By GraemeJ in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 5th December 2010, 04:00
  2. PIC - 8 Pins - 6 Output Pins ?
    By DanPBP in forum Off Topic
    Replies: 0
    Last Post: - 22nd October 2007, 00:23
  3. Replies: 2
    Last Post: - 17th February 2006, 09:52
  4. Analog pins for digital input
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 9th September 2005, 00:32
  5. How can i control pic input pins order?
    By tanero in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 18th August 2005, 12:46

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