News:

;) This forum is the property of Proton software developers

Main Menu

Usart TX buffer is there one?

Started by TimB, May 08, 2021, 05:17 PM

Previous topic - Next topic

TimB


I'm just checking as I do think I have seen a prog already.

I have a USART TX interrupt buffer working. Fill the array, send it  and it's all emptying in the background.
The issue is that to do your normal hrsoutln Dec6 myvar stuff I have to use a Dec to string command. That works as long as I work out the size at the end and then start sending it.

The issue is that I want to send several packets eg Hrsoutln Dec6, mydata: Hrsoutln Dec4, MyOtherData. Its possible just add the data to the end of the first string.

Then I thought I could replace Hrsout with my own code that will do all the packing of the string, the packet sizes etc.

But why reinvent the wheel. I'm sure Les has done this already. But I cannot find it. I can find the RXbuffers not a TXbuffer

So thats my question. Is there one? Do I do it myself?

Thanks

Tim

trastikata

Tim, strings are null-terminated, why not use the zero as a marker indicating when to stop sending from the current string.

Add to that a variable that will initially hold the length of the string currently being transmitted, that variable will decrease with each symbol send in the interrupt routine.

Poll the variable regularly in the main code and as soon as it hits zero, you can start sending the next string.

TimB


Hi

Thanks, I do know how strings work. I also know that HRSOUT 123 does not add a 0 to the end of 123.

I decided to do the job properly and have written the interrupt driven routine. Replacing the HRSOUT command with my own that stuffs a ring buffer and manages the unloading in the interrupt routine. I can now send strings, data. Use Hrsoutln with no messing around, and no polling.

Tim