18F8722 PortF Problem


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2004
    Location
    nebraska
    Posts
    79

    Default 18F8722 PortF Problem

    Hello
    I am using a PIC 18F8722 and I am having a problem reading PORTF. I ran into a problem reading the portf in a project of mine and this code I am just testing it to see what happens.

    In the code below I set portF to a certain value and then make Temp1 = to PortF to display on a LCD. When the program runs I get all 8 outputs of the pic to turn on but I get a value of 128 to display on the lcd. If I change PortF to any value below 128 I get 0 to display on the LCD. No matter what value I put in I always get the right state on the 8 output pins. I have no Idea what is going on.
    DEFINE OSC 40 'Define clock freq. 40MHz
    pause 1000
    TRISF = 0 'Define PortF TRIS Register.
    TRISC.0 = 0 'Define PortC TRIS Register.
    LCD Var portC.0 ' LCD Data debuging pin.
    Temp1 Var word
    PortF = 255
    Temp1 = PORTF
    Serout2 LCD,16468,[12,DEC Temp1 ]
    pause 3000
    end


    Thanks
    Shawn

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: 18F8722 PortF Problem

    Port F on that chip has some analog features. You will need to turn that off.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Dec 2004
    Location
    nebraska
    Posts
    79


    Did you find this post helpful? Yes | No

    Default Re: 18F8722 PortF Problem

    Thanks Dave
    Turning the AD Module off does not fix the problem but you got me thinking. After I turned the AD module off, I changed ADCON1 0-3 to all digital and that did the trick. Thanks again for the help. I would have beat my head for awhile without your post.

    Shawn

Members who have read this thread : 0

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