PORTB not behaving - Page 2


+ Reply to Thread
Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18

Thread: PORTB not behaving3700 days old

  1. #16
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,676
    Thumbs Up
    Received: 47
    Given: 95
    Total Downloaded
    1.32 GB

    0 Not allowed!

    Default

    Aaaaa of cause!!!

    Its so obvious once you spot it
    Tim

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.

  • #17
    Prolific Poster shantanu@india's Avatar
    Join Date
    Feb 2007
    Posts
    1,701
    Thumbs Up
    Received: 7
    Given: 21
    Total Downloaded
    827.23 MB

    0 Not allowed!

    Default

    This issue taught me another thing.......the 'TXIF' flag of PIR1 is not all that dependable as acknowledged by Microchip themselves:

    Once the TXREG register transfers the data to the TSR
    register (occurs in one TCY), the TXREG register is empty
    and the TXIF flag bit (PIR1<4>) is set. This interrupt can
    be enabled or disabled by setting or clearing the interrupt
    enable bit, TXIE (PIE1<4>). TXIF will be set regardless of
    the state of TXIE; it cannot be cleared in software. TXIF
    is also not cleared immediately upon loading TXREG, but
    becomes valid in the second instruction cycle following
    the load instruction. Polling TXIF immediately following a
    load of TXREG will return invalid results.

    While TXIF indicates the status of the TXREG register,
    another bit, TRMT (TXSTA<1>), shows the status of
    the TSR register. TRMT is a read-only bit which is set
    when the TSR register is empty. No interrupt logic is
    tied to this bit so the user has to poll this bit in order to
    determine if the TSR register is empty.
    What I found is that polling TXIF is only good enough for sending back to back data to the USART but not dependable to trigger any other event based on the state of the USART.

    When I tried the following code to send only one byte, the tx_enable line again failed to generate the proper pulse width though I had polled the TXIF bit:

    Code:
    Low tx_enable
                    HSerOut [ "p" ]
                    While PIR1.4=0 : Wend
                    High tx_enable
    But the same thing worked absolutely O.K when instead of 'TXIF' I polled 'TRMT'

    Code:
    Low tx_enable
                    HSerOut [ "p" ]
                    While TXSTA.1=0 : Wend
                    High tx_enable
    Therefore polling 'TRMT' bit of TXSTA is much more dependable & I suggest that the other forum members use it more often.
    Shantanu

  • 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.

  • #18
    Ashfaq
    Guest Ashfaq's Avatar

    0 Not allowed!

    Default

    thanks for letting us know. Good to know that the problem is solved. I will also keep this in mind for the future.

  • 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. [SOLVED !] PWM and portB
      By wilfrieds in forum Proton Plus Compiler v3
      Replies: 6
      Last Post: 7th November 2011, 08:44
    2. reading PORTB
      By heliaddict in forum Proton Plus Compiler v3
      Replies: 5
      Last Post: 22nd November 2008, 20:04
    3. [SOLVED !] PortB is not behaving
      By HelpMe! in forum Proton Plus Compiler v3
      Replies: 18
      Last Post: 31st May 2008, 12:03
    4. My flash chips are behaving like OTPs
      By jonnykyoto in forum Proton Plus Compiler v3
      Replies: 4
      Last Post: 2nd July 2006, 00:45
    5. Confused about portb
      By David Blackburn in forum Proton Plus Compiler v3
      Replies: 6
      Last Post: 3rd June 2005, 20:50

    Members who have read this thread since 13th December 2019, 18:12 : 0

    Actions :  (Set Date)  (Clear Date)

    You do not have permission to view the list of names.

    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