- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Greetings,
Why does the UART Transmission of 32bit INT using sprintf() takes lesser time than to transfer 8 bit using sprintf().
Is there any other faster way to transfer integer of 32bit accept WriteTxData() API?
Thanks in advance
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
With the help of sprintf() you transmit values converted to ASCII which have to be scanned to get back integers.
Sprintf() does not send directly, you need to send the resulting buffer[] which length depends on the format you used.
You may send the values directly but there are some pitfalls:
- Sender and receiver might have different endianess.
- All bytes are valid codes, there is no choice for a sync character or similar
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ohkk. But still sending 4 bytes of data using PutString command takes less time than sending 1 or 2 byte. It should be other way round kn..
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you please upload your complete project archive, I'll check.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
sprintf(temp,"%d%d%d%d%d%d",valHH,valHL,valLH,valLL,ref1,ref2);
A %d will convert your value of 65 to the two digits "6" and "5".
This will fill temp with a string of 12 characters. You only show your results sparingly. I would suggest you to connect the
tx_en signal to a pin and monitor it with a logic analyzer or a scope. it will show the exact time needed for transmission.
Additionally I would suggest to set compiler optimization to "speed".
The situation will change completely when you set the Tx Buffer Size to 20..100. While the buffer gets filled the characters are transferred in the background until the buffer is full and the program will wait for room in the buffer. A CyDelay() in main loop can prevent that.
Pure transmission time fot a byte is @115200baud about 100µs,
Bob