portA.0 cannot be set


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,627


    Did you find this post helpful? Yes | No

    Default Re: portA.0 cannot be set

    Do you have the pins connected to anything? It smells like the good old Read-Modify-Write problem...

    What if you try:
    Code:
    trisa=0
    main:
       porta.0=0
       Pause 1    'Allow PortA.0 to settle low.
       porta.1=0
       pause 10
       porta.0=1  'Allow PortA.0 to settle high
       Pause 1
       porta.1=1
       pause 10
       goto main
    HIGH and LOW also resets the corresponding bit in the TRIS register (making the pin output) for you so even if you have the pin setup as an input doing HIGH PortX.x will switch it to an ouptut and set it high. I'm not sure WHY it matters in THIS case but we can figure that out IF it turns out to BE a RMW-problem.

    /Henrik.

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


    Did you find this post helpful? Yes | No

    Default Re: portA.0 cannot be set

    You will need to turn the ADC off.
    ADCON1 = 15
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Nov 2007
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: portA.0 cannot be set

    Henrik,

    It was a read-write-modify issue.
    a simple PAUSEUS 1 between instructions solved it.
    Thanks!

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default Re: portA.0 cannot be set

    Bonjour Patrice,

    Or simply Write " HIGH or LOW PortA.0 " ... it will automatically add a little time ... ( equal to TRISA.0 = 0 ... )

    hé,hé ... soyons flemmards !!!

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  5. #5
    Join Date
    Nov 2007
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: portA.0 cannot be set

    Bonjour Alain,

    You are right, I had noticed that writing "high" or "Low" indeed worked as well.
    This is the first time I design a project running at 40 Mhz, so I am dealing with new issues I have not seen before.

    You learn every day!

    A+

    Pat

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


    Did you find this post helpful? Yes | No

    Default Re: portA.0 cannot be set

    Salut Patrice,

    With PIC18, there's LAT port made to avoid this problem

    You write to LAT ... but read from PORT
    LATA.0=1
    LATA.1=1
    LATA.2=1
    LATA.3=1
    Steve

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

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