Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

UART Serialout buffer question

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
Yokablasta

Bascom Member



Joined: 13 Dec 2017
Posts: 19

PostPosted: Fri Aug 16, 2019 10:14 pm    Post subject: UART Serialout buffer question Reply with quote

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
View user's profile
enniom

Bascom Member



Joined: 20 Oct 2009
Posts: 537

PostPosted: Sat Aug 17, 2019 5:27 pm    Post subject: Reply with quote

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
View user's profile
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 2262

blank.gif
PostPosted: Mon Aug 19, 2019 1:32 pm    Post subject: Re: UART Serialout buffer question Reply with quote

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
View user's profile
Yokablasta

Bascom Member



Joined: 13 Dec 2017
Posts: 19

PostPosted: Fri Aug 23, 2019 8:21 pm    Post subject: Reply with quote

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
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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