Shop OBEX P1 Docs P2 Docs Learn Events
viewing data in a block of ramspace — Parallax Forums

viewing data in a block of ramspace

irideforchristirideforchrist Posts: 1
edited 2012-07-19 14:55 in Propeller 1
Hello all!

I am trying to read recieved serial data into a block of ram using long move but the data dosnt seem to be going to the block of ram am I using the complete wrong command/ approach the device Im trying to read from requires an unknown code sequence elese the watchdog timer times out communication.

heres the block of code Im trying to grab the data from


PRI RxCheck : bytechr
{Check if character received; return immediately.
Returns: -1 if no byte received, $00..$FF if character received.}
bytechr~~
if rx_tail <> rx_head
bytechr := rx_buffer[rx_tail]
rx_tail := (rx_tail + 1) & BUFFER_MASK
bytechrbuff := bytechr
longmove(@buffer, @bytechrbuff, 3000) ' adding this to copy data to memory

Thanks in advance for any help on this!

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-07-19 13:04
    attachment.php?attachmentid=78421&d=1297987572

    Please repost with proper formatting.
  • Dave HeinDave Hein Posts: 6,347
    edited 2012-07-19 13:23
    Mike, if you click on "Reply With Quote" you can see the original formatting.

    iride, it would be good to use the [ code ] and [ /code ] delimeters to preserve the indentation. It would also be good if you could post all your code. If buffer is 12,000 bytes in size you will be wiping out other parts of memory with the longmove. Also, you're really just copying the value of bytechr to the first long in buffer along with 2999 other longs that probably aren't useful. Post all your code, and we should be able to help you.
  • turbosupraturbosupra Posts: 1,088
    edited 2012-07-19 14:55
    Hello IRideForChrist,

    Here is how I receive data from the pst to my program

    If pst.RxCheck does equal -1, ignore, but if it does not return a -1, array b_waitingToBeParsed increments by 1 and assigns the incoming byte to that array value.
    It continues to increment that until it sees a carriage return (13) and then it sends the data to a parsing routine called DelimiterFinder. I can post that too if you need it, but I'm not sure what you are doing with the data so I won't post it yet. After that it clears the array b_waitingToBeParsed and its index and waits for the next set of characters and carriage return.

    CON
      _CLKMODE      = XTAL1 + PLL16X                        
      _CLKFREQ      = 80_000_000
      
      _byteLimit = 100
    
    VAR
    
      byte b_delimiter, b_prefix[_byteLimit], b_suffix[_byteLimit]
      byte b_waitingToBeParsed[_byteLimit]
      byte b_byteMoveIndex
      byte b_RxString[_byteLimit]
    
    
    
    PUB Com
    
          l_myReceivedByte := pst.RxCheck
           
          if l_myReceivedByte <> -1
            b_waitingToBeParsed[b_byteMoveIndex++] := l_myReceivedByte      
           
            if l_myReceivedByte == 13
              DelimiterFinder(@b_waitingToBeParsed)
              ByteFill(@b_waitingToBeParsed, 0, strsize(@b_waitingToBeParsed))
              b_byteMoveIndex := 0    
           
    
    Hello all!

    I am trying to read recieved serial data into a block of ram using long move but the data dosnt seem to be going to the block of ram am I using the complete wrong command/ approach the device Im trying to read from requires an unknown code sequence elese the watchdog timer times out communication.

    heres the block of code Im trying to grab the data from
    PRI RxCheck : bytechr
    {Check if character received; return immediately.
      Returns: -1 if no byte received, $00..$FF if character received.}
      bytechr~~
      if rx_tail <> rx_head
        bytechr := rx_buffer[rx_tail]
        rx_tail := (rx_tail + 1) & BUFFER_MASK
        bytechrbuff := bytechr                                   
        longmove(@buffer, @bytechrbuff, 3000)                               ' adding this to copy data to memory
    
    Thanks in advance for any help on this!
    
    
Sign In or Register to comment.