Tris


+ Reply to Thread
Results 1 to 12 of 12

Thread: Tris699 days old

  1. #1
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,281
    Thumbs Up
    Received: 78
    Given: 182
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default Tris

    From a typical Microchip datasheet
    The contents of the TRISC register are affected by peripheral overrides. Reading TRISC always returns the current contents, even though a peripheral device may be overriding one or more of the pins.
    does this mean

    a. if I read a TRIS register I get the original values I TRIS'ed it to.
    b. if I read a TRIS register I get the current i/o status of the port (as potentially modified by a peripheral).

    Just for context, the following preceeds the above
    When enabling peripheral functions, care should be taken in defining TRIS bits for each PORTC pin. The EUSART and MSSP peripherals override the TRIS bit to make a pin an output or an input, depending on the peripheral configuration. Refer to the corresponding peripheral section for additional information.
    George.

Attention
×

This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

The advertisements we display are relevant to this web site and your browsing history

Please consider supporting us by disabling your ad blocker.


Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

If you can, please report issues in the forum area WebSite / Forum Issues


Thank you for your attention.

  • #2
    Senior Member tumbleweed's Avatar
    Join Date
    May 2011
    Posts
    498
    Thumbs Up
    Received: 59
    Given: 0
    Total Downloaded
    408.14 MB

    1 Not allowed!

    Default Re: Tris

    a.

    (but it wouldn't surprise me if you find a chip where it means b. With PICs you're best off assuming there's no such thing as a "typical" part)

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #3
    Senior Member Henk57's Avatar
    Join Date
    Jan 2014
    Posts
    406
    Thumbs Up
    Received: 19
    Given: 35
    Total Downloaded
    192.60 MB

    0 Not allowed!

    Default Re: Tris

    a and b.

    If that port pin is the SDA pin (I2C) than it changes to input/output.
    Even if you set it in the begin as an input.

    Henk.

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #4
    Senior Member tumbleweed's Avatar
    Join Date
    May 2011
    Posts
    498
    Thumbs Up
    Received: 59
    Given: 0
    Total Downloaded
    408.14 MB

    0 Not allowed!

    Default Re: Tris

    I took George's question to be asking if the TRIS register changes, but I could be wrong.

    Once you enable certain peripherals (like the uart and I2C) they take control of the pin direction, but I've never noticed it change the TRIS register setting.

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #5
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,281
    Thumbs Up
    Received: 78
    Given: 182
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default Re: Tris

    @tumbleweed "With PICs you're best off assuming there's no such thing as a "typical" part". Too true

    @Henk57 Its not a question wether a peripheral can change the i/o status of a port but wether that change is reflected in the value read from TRIS. It seems strange to me that it is not.

    So is there any mechanism were a Pic device can deterine the current i/o status of its ports?
    George.

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #6
    Senior Member tumbleweed's Avatar
    Join Date
    May 2011
    Posts
    498
    Thumbs Up
    Received: 59
    Given: 0
    Total Downloaded
    408.14 MB

    0 Not allowed!

    Default Re: Tris

    So is there any mechanism were a Pic device can deterine the current i/o status of its ports?
    I don't think there is.

    Let's say you're using the MSSP I2C and you send a START. You'd end up with SCL and SDA being asserted low, but the TRIS bits would still be '1'.

    You could read the PORT register, but I'm not sure how you could tell if you were the one holding them low or something external was doing it. You'd have to know that the MSSP was enabled, disable it, and see if the pins changed state.

    Is there something particular you're looking to do?

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #7
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,281
    Thumbs Up
    Received: 78
    Given: 182
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default Re: Tris

    Is there something particular you're looking to do?
    Among other things, report the status of each port, both value and i/o status.
    George.

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #8
    Senior Member tumbleweed's Avatar
    Join Date
    May 2011
    Posts
    498
    Thumbs Up
    Received: 59
    Given: 0
    Total Downloaded
    408.14 MB

    0 Not allowed!

    Default Re: Tris

    I dunno George. I don't have any good ideas.

    You can read the PORT reg and get the current state of the pins, but much past that I think you're sorta SOL.

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #9
    Junior Member wirecut's Avatar
    Join Date
    Nov 2018
    Posts
    96
    Thumbs Up
    Received: 1
    Given: 5
    Total Downloaded
    1.16 GB

    0 Not allowed!

    Default Re: Tris

    t is normal that after the instruction: PinMode 0, Output
    the pin is not really in output?

    In other words, I noticed that to set PORTA.0 to output, I have to write one of the following instructions:
    - Low PORTA.0
    - High PORTA.0
    - TRISA.0 = 0

    I assumed that PinMode 0, Output did the same but it is not.
    Is it normal or is it an anomaly?

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #10
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,281
    Thumbs Up
    Received: 78
    Given: 182
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default Re: Tris

    My original question was weather shanges made to the input/output condition by onboard peripherals are reflected in the TRIS registers. The net result of the this thread is yes, no, maybe, sometimes or who knows.
    George.

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #11
    Junior Member wirecut's Avatar
    Join Date
    Nov 2018
    Posts
    96
    Thumbs Up
    Received: 1
    Given: 5
    Total Downloaded
    1.16 GB

    0 Not allowed!

    Default Re: Tris

    Haha (laughter)
    I asked an oracle and he told me that the answer is 42.

    (https://en.wikipedia.org/wiki/The_Hi..._to_the_Galaxy)
    Last edited by wirecut; 23rd June 2019 at 20:10.

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #12
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,478
    Thumbs Up
    Received: 314
    Given: 146
    Total Downloaded
    1.99 GB

    1 Not allowed!

    Default Re: Tris

    With Microchip's past record, I woudl also go with the answer of both could happen :-)

    The TRIS SFRs were primarily designed for writes to them and not all peripherals will write to the TRIS register when they overwride it to make pins inputs or output because they can go underneath it. I've only read from a TRIS when saving/restoring them in an interrupt that also alters port settings, and I have always made a shadow copy of the current TRIS so the program knows what was in it because the device screwed it up etc... LOL

  • Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

    Thread Information

    Users Browsing this Thread

    There are currently 1 users browsing this thread. (0 members and 1 guests)

       

    Similar Threads

    1. 18F8722 Port J TRIS anomaly
      By rcurl in forum Proton Plus Compiler v3
      Replies: 2
      Last Post: 20th November 2008, 00:05

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts