How to display ASCII data

asked Dec 4, 2018 in Embedded Wizard Studio by DongdongA

version 6.5

I want to display some fault codes on the screen in hexadecimal mode.

can  Views::Text + string() do that? and how?

Does the string function support format conversion?





1 Answer

0 votes
answered Dec 4, 2018 by Paul Banach
Best answer


with the version 8.20 we have enhanced the set of string() instant constructors to do what you expect. This however is not available in the old version 6.50. You have two possibilities:

Option 1: Update to the newest version (actually 9.10).

Option 2: Implement your own format function in Chora to convert a number in HEX string. The following example demonstrates it:

var uint32 number = ...
var string digits = "0123456789ABCDEF";
var string result = "";

while (( number != 0 ) || ( result.length == 0 ))
  result = digits[ int32( number & 0xF )] + result;
  number = number >> 4;

return result;

Best regards

Paul Banach

commented Dec 4, 2018 by DongdongA

That's very useful. Thank you very much for your answer.

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint