View previous topic :: View next topic |
Author |
Message |
Yokablasta
Joined: 13 Dec 2017 Posts: 19
|
Posted: Fri Aug 16, 2019 10:14 pm Post subject: UART Serialout buffer question |
|
|
Hello,
I have a project here that reads in strings of serial data, then processes and transmits the strings. Each string has a status header, which tells the cpu what kind of string (how many bytes) we are transmitting. I am using the hardware uart serial output buffer. Most of these strings can be transmitted FIFO, however, there is one class of string that needs to move to the front of the buffer, as soon as the last string is finished transmitting (IE, as soon as the next byte in line is one of the status headers.) I want to insert the high priority string and immediately transmit it. I am not very familiar with how to manipulate the output buffer, or if it is even possible. Can anyone recommend an approach to this?
I was hoping to move the head and tail pointers to the left and right of the string I just placed in the buffer, then once transmitted, move the head and tail back to the original values. Does this sound like the way to do this?
(BASCOM-AVR version : 2.0.8.2 ) |
|
Back to top |
|
|
enniom
Joined: 20 Oct 2009 Posts: 537
|
Posted: Sat Aug 17, 2019 5:27 pm Post subject: |
|
|
Have you considered OVERLAY on the sections you want to move?
Code: | Dim A_str as String * 10 at *BUFFER(xx)* Overlay
Dim B_str as String * 10 at *BUFFER(YY)* Overlay
Dim Temp_astr as String *10
Dim Temp_bstr as String *10
'*****
Temp_astr = A_str
Temp_bstr = B_str
A_str = Temp_bstr
B_str = Temp_astr
'****
|
E |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Mon Aug 19, 2019 1:32 pm Post subject: Re: UART Serialout buffer question |
|
|
Yokablasta wrote: | to manipulate the output buffer, or if it is even possible. |
It is, but the result may be a mess, i.e. unreliable, as you do not have full control over the buffer-routines.
Quote: | to move to the front of the buffer, as soon as the last string is finished transmitting |
If 'last string' is not a misspell, then simply don't print anything else and wait for _RS_TAIL_PTR equals _RS_HEAD_PTR, as then the last byte is sent out.
By printing then the high priority string, it will be sent out immediately.
In case 'last string' should actually tell 'most recent string' while more prints/strings are in the output-buffer, then I do not see how you would know the end of the recent string.
At the moment of print they are strings, numbers, a.s.o., but as soon as in the buffer, it's only one array of data, where the buffered-out routine will stoically send out byte per byte till nothing's left.
Quote: | I was hoping to move the head and tail pointers to the left and right of the string I just placed in the buffer, then once transmitted, move the head and tail back to the original values. Does this sound like the way to do this? |
It sounds like a good way to chaos. |
|
Back to top |
|
|
Yokablasta
Joined: 13 Dec 2017 Posts: 19
|
Posted: Fri Aug 23, 2019 8:21 pm Post subject: |
|
|
MWS,
This makes sense, and it answers my question about whether the contents of the output buffer can be examined. If it is the case that once something gets put in the buffer, then it stoically gets worked off, then it sounds like I need to re-examine my approach to using the output buffer. Perhaps instead of printing the data as it happens, I should create a software buffer and prioritize which strings get sent to the output buffer? |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|