UART Output is limiting to 20 Characters

Use this section to discuss your embedded Flowcode projects.
Post Reply
jay_dee
Posts: 229
http://meble-kuchenne.info.pl
Joined: Sun Dec 20, 2020 6:06 pm
Has thanked: 91 times
Been thanked: 58 times

UART Output is limiting to 20 Characters

Post by jay_dee »

Hi,
I would appreciated a second opinion on this.
Attached is a simple bit of FC used for testing another program. It builds a string and sends this out over the UART at 57Kbit.
A assembled string can be over 20 characters
FC is attached.

In simulation the output stream is fine, both UART Console and the assembled string shown on a console Writer are fine, with strings over 20 Characters
Serial_Diag_Console.JPG
Serial_Diag_Console.JPG (47.51 KiB) Viewed 593 times
hardware is PIC18F2585 and the output string is always tuncated to 20 charaters. I dont think it is a hardware limitation.
~1,9,1,MyValue ECT,2$
~1,10,1,MyValue ECT,$
~1,11,1,MyValue ECT,$
I'm fairly sure the error is somewhere in the string concatenation, as the last value (my terminating character $) is always correctly added.
But the value (just before the terminating character) is being truncated to a length that always results in of 20 char max.

I've checked my FC variable to ensure everything is sized to handle a string larger than this, but the problem persists.
Any Thoughts? J.
Attachments
PIC18F_SendDiagnostic_V4_WIP.fcfx
(24.6 KiB) Downloaded 20 times

stefan.erni
Valued Contributor
Posts: 1065
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 201 times
Been thanked: 224 times

Re: UART Output is limiting to 20 Characters

Post by stefan.erni »

Hi jay_dee

one question:
Do the 4 strings have to add up to 30 instead of 20?
2025-08-18_14-42-01.PNG
2025-08-18_14-42-01.PNG (15.45 KiB) Viewed 576 times

jay_dee
Posts: 229
Joined: Sun Dec 20, 2020 6:06 pm
Has thanked: 91 times
Been thanked: 58 times

Re: UART Output is limiting to 20 Characters

Post by jay_dee »

Thanks,
My string contents will have a varying length.
It does not appear to make any difference what length I make the resultant's String length. i.e. TXstring[25]
I dont know the details of how strings are concatenated TBH, But I presumed that if an actaul string was 4 characters but the string containing variable was declared as 10 characters, that is just a limit on the size reserved in memory.

I have tried various sized strings for the resultant, including 30...no improvment.
Hmm. J.

stefan.erni
Valued Contributor
Posts: 1065
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 201 times
Been thanked: 224 times

Re: UART Output is limiting to 20 Characters

Post by stefan.erni »

Hi jay_dee

Sorry, my help was wrong. I didn't notice a line.
I think you're doing everything right. Maybe you can split it into two strings as a test.
PIC18F_SendDiagnostic_V4_WIP.fcfx
(25.2 KiB) Downloaded 23 times
2025-08-18_15-28-35.PNG
2025-08-18_15-28-35.PNG (218.02 KiB) Viewed 566 times

chipfryer27
Valued Contributor
Posts: 1676
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 372 times
Been thanked: 581 times

Re: UART Output is limiting to 20 Characters

Post by chipfryer27 »

Hi

I'm not sure if this is still the case, but previously FC had an issue in concatenating strings if you tried to do multiple concatentations at once

Test$ = ""
Test$ = Test$ + "abc"
Test$ = Test$ + "123"

Would give you Test$ = "abc123"

However if you tried

Test$ = ""
Test$ = Test$ + "abc" + "123"

Would not give you the expected result.

May not be the issue anymore though.

Regards

jay_dee
Posts: 229
Joined: Sun Dec 20, 2020 6:06 pm
Has thanked: 91 times
Been thanked: 58 times

Re: UART Output is limiting to 20 Characters

Post by jay_dee »

Thanks Guys,
I forced the "UART Send String" macro to send -- .TxString = "~1,1,1,My Value ECTBB,12345$" which is more than 20 Char
This is sent fine, so its not a hardware or UART buffer issue.

Looks like a concatenation issue with strings over 20 char.
I cant find a working concatentaion method yet, So I'll be interested if the FC team know of a good workaround or known issue.

In the mean time, I'm splitting the String into Two, and just sending them one, after the other. Bit clunky but seems to work.
Thanks, J.

chipfryer27
Valued Contributor
Posts: 1676
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 372 times
Been thanked: 581 times

Re: UART Output is limiting to 20 Characters

Post by chipfryer27 »

Hi

I frequently send strings many tens of characters long (usually somewhere between 80 - 120) out over the UART. However I always create my string in small chunks as mentioned above, adding one string at a time.

Regards

Post Reply