Shop OBEX P1 Docs P2 Docs Learn Events
Extended_FDSerial String buffer — Parallax Forums

Extended_FDSerial String buffer

Chicago MikeChicago Mike Posts: 88
edited 2007-06-14 11:47 in Propeller 1
When using Extended Full Duplex serial to receive strings, is it common practice to flush the buffer after reading the buffer? I'm receving speratic strings from a device, and I have it delimited by commas. I'm parsing statments from time to time from the input buffer (datain). But I'm worried about 2 things.

1> When using the Serial.RxStr(@myStr) with the delimiter set, does it clear from the buffer the serial string I am receving into @myStr? Making a FIFO style buffer, or do I need to flush the buffer in some fashion. (From what I can figure, the the rxflush would clear the entire buffer, which is NOT what i would want).

2> My processing may not be on a regular interval. I may need to receive 3-6 commands before processing. Since the buffer is only 16 bytes, and my strings are 8 each, Can I just increase the datain buffer size without worry.

Sorry, I can't try these things now, or even this week, and I'm trying to code this up while I'm away.

Thanks!

Comments

  • KaioKaio Posts: 253
    edited 2007-06-13 14:41
    Mike,

    1. The array datain is not the real receive buffer, which is located in FullDuplexSerial.spin and is named rx_buffer. When you use the method Serial.RxStr(@myStr) the bytes will be read from receive buffer until a delimiter is received or the maximum size (15) of string is achieved.

    2. You are right. In your case you have to increase the size of receive buffer. How I explained above the receive buffer is located in FullDuplexSerial.spin, but you can not change the size of the buffer easily. You have to change some locations in the Spin and assembly code to take care of the buffer size.

    Thomas
  • DroneDrone Posts: 433
    edited 2007-06-14 11:47
    Mike,

    Mirror has modified the full-duplex serial driver V1.1 in various ways - one of which is to increase the buffer to 64 bytes. His object is called SerialMirror. If SerialMirror doesn't do what you need just comparing SerialMirror to the standar full-duplex serial driver may ease your effort to increase the buffer size. I haven't tried SerialMirror myself.

    See this post where Mirror introduces SerialMirror:

    http://forums.parallax.com/forums/default.aspx?f=25&m=189806
Sign In or Register to comment.