Losing data when extracting bytes from words - 16F18855


+ Reply to Thread
Results 1 to 26 of 26

Hybrid View

  1. #1
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,170


    Did you find this post helpful? Yes | No

    Default Re: Losing data when extracting bytes from words - 16F18855

    Quote Originally Posted by richard View Post
    more robust demand/response handshaking...


    Once I TX data, I waited till TX complete:

    The TXIF flag does not indicate transmit completion (use TRMT for this purpose instead).
    (16F18855 p.146)


    Then I sit in a loop waiting for RX interrupt:

    To ensure that no actual data is lost, check the RCIDL bit to verify that a receive operation is not in process...
    (16F18855 p.553)


    Code:
    ;--- Interrupts ----------------------------------------------------------------
    
    RXInterrupt:
        hserin [ STR MsgData\3  ]
    
        while BAUDCON1.6 = 0                        ' Check RCIDL bit
        wend
    
        RXoccurred = 1                              ' Set flag
    @ INT_RETURN
        
    ;--- Subroutines ---------------------------------------------------------------
    
    SendData:
    
        hserout [   MsgData[0], MsgData[1], MsgData[2]   ]                             
    
        while TX1STA.1 = 0                           ' Check TRMT bit
        wend
    
        while RXoccurred = 0                       ' Check for interrupt
        wend
    
        RXoccurred = 0                              ' Set flag
        ADCchange = 1
    RETURN

    I turned the pot pretty fast and this is the fastest interval I got from start of 1st TX to start of 2nd TX:

    Name:  Fastest pot movement.png
Views: 17517
Size:  37.5 KB


    I'm still studying your TX/RX module. At least now I have a control that I can compare with.
    Last edited by Demon; - 16th March 2025 at 00:43.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,170


    Did you find this post helpful? Yes | No

    Default Re: Losing data when extracting bytes from words - 16F18855

    To make sure I wasn't losing data, I returned the data I received. I also used the 45mm slide pot for another speed test; zipping that sucker as fast as I could: 1.234 mSec from start to start of TX.

    These are the signals, in case the text from Saleae probe is not clear enough (they get a little fudgy or some reason):

    Primary PIC:
    - TX

    Secondary PIC:
    - RX-INT
    - LCDout ADC values
    - TX confirmation
    - LCDout "X" indicator (this is for testing only, to see if other pots "jitter")

    Note that data is not lost even if bottom LCDout overlaps into next message.

    Name:  Fastest pot movement v2.png
Views: 15808
Size:  94.8 KB
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  3. #3
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,170


    Did you find this post helpful? Yes | No

    Default Re: Losing data when extracting bytes from words - 16F18855

    I figure I'd push the envelope a bit faster with that 45mm slide pot; 1.228 mSec from start to start of TX.

    I also took out that 2nd LCDout with the "x" indicator, it was just for testing anyways.

    This time I went faster than the previous ADC increment changes of 3, I managed to go to 7 and still no data lost:

    Name:  Fastest pot movement v3.png
Views: 15749
Size:  100.5 KB
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

Similar Threads

  1. Decoding serial data bytes and nibbles.
    By retepsnikrep in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 18th January 2018, 08:22
  2. Bits, Bytes Words and Arrays
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 24
    Last Post: - 14th June 2016, 07:55
  3. ORing / ANDing bytes or words
    By mmargolis in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 19th March 2011, 20:12
  4. Success! Are they 'words' or are they 'bytes'?
    By BitHead in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 27th December 2009, 16:54
  5. Codespace Saving Tip... Don't mix Words and Bytes
    By Melanie in forum Code Examples
    Replies: 0
    Last Post: - 18th June 2004, 10:23

Members who have read this thread : 14

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