Port A Issues


Closed Thread
Results 1 to 3 of 3

Thread: Port A Issues

  1. #1
    Join Date
    Apr 2005
    Location
    Virginia
    Posts
    65

    Question Port A Issues

    Hello, I'm having extremely bad luck with my "a" ports on my PIC 18F2525. I've included a snippet from a large program to help demostrate my program.

    In effect, port a causes me nothing but trouble if I use for anything other than a simple on/off output. I understand it houses the A/D stuff and is consequently fickle to begin with. Thus, I've limited its use to turning on and off LEDs and powering a couple of switches (strictly output).

    However, in my program I turn on one LED on porta.1 then immediately put power to a BCD switch on porta.4. As soon as porta.4 goes high, porta.1 goes low and turns off the LED! Here's a sample of code:

    trisa = %00000000 'Set all port a's to outputs
    porta = %00000000 'Set all ports on a to low
    adcon1 = 7 'Make porta all digital I/O's
    Main:

    porta.1 = 1 'Light an LED

    goto Switch_On

    Switch_On:

    porta.4 = 1 'porta.1 goes off for no apparent reason

    'Do something

    goto Main




    And porta.1 goes off! Anyone have any ideas or suggestions?

  2. #2
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Default

    Please check:

    Does PortA.4 require an Pull-Up-Resistance ?
    Did you trap into a read-modify-write-problem, because to output of PortA.1 is bad designed and the voltage on this output can't rise to 3,x Volt or more. Then this input is read as "0" and written as "0" while changing PortA.4 !

    www.sprut.de

  3. #3
    Join Date
    Apr 2005
    Location
    Virginia
    Posts
    65


    Did you find this post helpful? Yes | No

    Thumbs up Solved!

    Okay, silly me had been looking at all the posts for overcoming the A/D features on the "a" ports and nearly everywhere I went, the example programs used ADCON1 = 7. Since I have a PIC18F2525, I have several more A/D ports (?) and needed to set all of these as digital I/O, not analog. Thus, the fix is:

    Adcon1 = $0F

    BigWumpus, thank you for the guidance.

    Hope this helps others!

Similar Threads

  1. Change On Interrupt, PIC16F884
    By elec_mech in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 14th November 2008, 17:25
  2. output port issues driving LEDs
    By p15218 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 27th August 2008, 21:42
  3. port config.
    By tamertokgoz in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 25th July 2008, 12:25
  4. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  5. STATUS re-curtain W
    By zugvogel1 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 13th February 2005, 15:21

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