• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

C to XML

Marco,

Here is a method that should work fine.

For each position of the Data Selector (0-7) you must construct, for both L&R displays the corresponding C++ string to show, including numbers, symbols and blank spaces.
After that, you must extract each one of the string positions and assign its value to the proper LVAR as detailed below:

Code:
(L:LDisplay:Digit1,number)
(L:LDisplay:Digit2,number)
(L:LDisplay:degreeSg1,number)
(L:LDisplay:Digit3,number)
(L:LDisplay:decimalSg1,number)
(L:LDisplay:Digit4,number)
(L:LDisplay:decimalSg2,number)
(L:LDisplay:Digit5,number)
(L:LDisplay:degreeSg2,number)
(L:LDisplay:NorthSouth,number)


(L:RDisplay:Digit1,number)
(L:RDisplay:Digit2,number)
(L:RDisplay:Digit3,number)
(L:RDisplay:degreeSg1,number)
(L:RDisplay:Digit4,number)
(L:RDisplay:decimalSg1,number)
(L:RDisplay:Digit5,number)
(L:RDisplay:decimalSg2,number)
(L:RDisplay:Digit6,number)
(L:RDisplay:degreeSg2,number)
(L:RDisplay:EastWest,number)

Digit values = 0-9 for numbers -1 Blank -2 (L)eft  -3 (R)ight
Degree sign = -1 Blank 1 Visible
Decimal sign = -1 Blank 1 Visible
NorthSouth = -1 Blank 0 North 1 South
EastWest = -1 Blank 0 East 1 West

If you can do this without much trouble, I can write the XML part to be displayed that, as you may guess, would be clean and simple. Or perhaps you might prefer to write it yourself.

Just let me know.

Tom

EDIT: This is for a single CDU unit, once proven that it works LVAR names may be adapted for 2-n units.
 
Tom,

I must admit your solution is as simple as brilliant!
It costs 21 * 3 = 63 LVars, and requires a macro as my "binary-string" solution, but it could probably be digested more easily by a third party XML developer.
In fact it's not 21 LVars vs just one because degree and decimal signs, and N/S and E/W icons, would be separate in both solutions so it would be 21 against 12, that's only 9 additional LVars (per INS unit).

I will seriously think about adopting your solutions and let you know. In case I'd take gladly advantage of your offer to provide the "string rebuilding" XML code as I would not be able to do that myself :(. In any case thank you very much for your availability which is always much appreciated!

One additional question for you is about the two degree and decimal signs each data display has: In C++ I rendered them using separate ICONs, because if I used the font's corresponding character I'd have shifted digits around (even using a proportional font) while, as in the real unit, they had to stick to their position.
Question is: Is it possible to use the same technique with XML?

And, BTW, adopting your solution would cost me no code rewriting at all because I still have to implement data display "bridging" code! (at the end I took the separate bridging gauge solution, so having 3 separate gauges, one for each INS unit, feeding relevant LVars. In this way, in a panel using a single INS for example, only one bridging gauge could be used, saving precious CPU and memory)

Once again thank you so much!
Marco
 
Marco,

I'm glad you find that method feasible.
In the C++ code, only one global function would be necessary to parse each data string (received as a parameter) and fill the group of LVARS. Very simple.

And in the XML front end, those LVARS may be displayed using a composed string , or a single, shifted bitmap (the method I use). In the end would depend on the third party developer's preference.

One additional question for you is about the two degree and decimal signs each data display has: In C++ I rendered them using separate ICONs, because if I used the font's corresponding character I'd have shifted digits around (even using a proportional font) while, as in the real unit, they had to stick to their position.
Question is: Is it possible to use the same technique with XML?

I believe it should be possible, depending on the font. And the same applies for N/S/E/W identifiers.

If handling more than one CDU, it is possible to write a single, master XML file. Once it is finished and tested it may be duplicated to n units, something like:

Code:
(L:CDU_1_Display:Digit1,number)
(L:CDU_1_LDisplay:Digit2,number)
...etc

(L:CDU_2_Display:Digit1,number)
(L:CDU_2_LDisplay:Digit2,number)
...etc

In CDU #1, use

<Macro Name="u">1</Macro>

(L:CDU_@u_Display:Digit1,number)
(L:CDU_@u_LDisplay:Digit2,number)
...etc

CDU #2 is a copy of #1, with a single replace that is

<Macro Name="u">2</Macro>

And so on

And 63 LVars is a small number, won't have any measurable impact in performance.

Tom

EDIT: ...but if perhaps anyone does not like having to deal with such a number of LVARS, it is still possible to use the "original" single name and identify the CDU where data is coming by using a custom value for each unit;)
 
Last edited:
Tom,

I don't understand what you're referring to, what do you mean when you say "custom value for each unit"?

Marco
 
Marco,

I mean composing the value of a single LVAR with each one of the 3 CDU values. It can be done using bitwise operations, as you did in your example, or by simply "building" a standard numeric value, which I see much simpler than the former.

Let's take one LVAR for the example, say (L:RDisplay: Digit1,number). In the C++ function you get the numeric value to be assigned to that var, but instead of making it direct, you apply an ID factor:

Code:
Pseudocode:
Values are [unit#1 = 8] [unit#2 = 5] [unit#3 = 12 (a flag value, for example BLANK)]
if( Unit is #1 )
{
   assign (8 * 10000) to  (L:RDisplay:Digit1,number)  = 80000
}
else if( Unit is #2 )
{ 
   add (5 * 100) to  current (L:RDisplay:Digit1,number) value = 80500
}
else
{
   add 12 to  current (L:RDisplay:Digit1,number) value = 80512

}

Now in the XML front end, extract codes would be something like:

Code:
Unit#1:
<Macro Name="DgEx">@1 10000 / int</Macro>

Unit#2:
<Macro Name="DgEx">@1 10000 / 1 % 100 * int</Macro>

Unit#3:
<Macro Name="DgEx">@1 100 / 1 % 100 * int</Macro>


And the "calling"  code:

(L:RDisplay:Digit1,number) sp0
@DgEx(l0)
etc...

Hope you get the idea, which supports as much variations as you can imagine.

Tom
 
Hope you get the idea
Well...Tom...no, I don't exactly get it, XML is still harder than hieroglyphs for me :confused:

What I understand is that, in your proposed method, you would still use one LVar for each digit but with the advantage of using ("sharing") a single L:Var for 3 INS units. And this, assuming I understood, makes things even more complex for me.

At present I'm still trying to use a single LVar for each string, and I will not give up until all possible solutions (coming to my mind) will have been proven to be non working.

I made tons of experiments trying to pass a 6 characters long (that's the longest I'd have to handle, and shorter == easier) from C to XML. Now I think I might have found a solution...I need to encode them into "pseudo BCD" using this map:
;
; Pseudo BCD Encoding Map
;
; Char = Hex
; 0 = 0x0
; 1 = 0x1
; 2 = 0x2
; 3 = 0x3
; 4 = 0x4
; 5 = 0x5
; 6 = 0x6
; 7 = 0x7
; 8 = 0x8
; 9 = 0x9
; Blank = 0xa
; L = 0xb
; R = 0xc
;

Using this conversion I would end up with a 6 chars string occupying only 3 bytes, and comfortably fitting a "long" type variable and should theoretically not be destroyed during FLOAT64 cast (conversion to floating point data types is not a simple cast, it involves conversion) while calling set_named_variable_typed_value().

Now to prove this works I'll have to write BCD to String decoder in XML which will take me days but it'll be a great chance to learn something ;)
I'll report back as soon as I'll have some kind of results, maybe somebody else is interested...

In any case thank you very much for your help!!

QUESTION: Does an XML "validator", "evaluator", "simulator" or something to test some XML code exists? Or the only chance it to let FS/P3D load it and then test/debug it using the supplied debugging facilities?

Thank you,
Marco
 
Marco,

What I understand is that, in your proposed method, you would still use one LVar for each digit but with the advantage of using ("sharing") a single L:Var for 3 INS units. And this, assuming I understood, makes things even more complex for me.

Actually this method cannot be more simple in the C++ front; with a single conversion function you solve everything.
And the XML part is easy as well, as I showed you. I know you will understand it as soon as you go deep into digesting XML scripts.

At present I'm still trying to use a single LVar for each string, and I will not give up until all possible solutions (coming to my mind) will have been proven to be non working.

Ok, then if you want a single LVAR for each string you will need 3 LVars for unit, total 9 LVars for 3 units plus another group of LVARs for decimal signs, Coordinate signs and degree signs. Am I right?

Suppose that I am, passing a 6 char string in a single, numeric LVAR is as simple as shown in my former posts. No need of BCD conversions, extra C++ functions or weird XML decodings.
I appreciate your efforts to find the best solution dealing with a "language" (XML) that you don't dominate yet, but at the same time I feel it's a shame that you are going to invest a lot of time trying to figure out a method that perhaps you think is complex when it is really not.

Again, I can give you the C++ and XML examples of what you want to obtain, if you are still interested of course! :stirthepo

QUESTION: Does an XML "validator", "evaluator", "simulator" or something to test some XML code exists? Or the only chance it to let FS/P3D load it and then test/debug it using the supplied debugging facilities?

There's none that I know of, appart from the debugging method of FS/P3D...that I don't really trust much.
Anyway, you can use any html browser (google,explorer) to test for XML file integrity, to ensure yourself that the file ("gauge") loads in the sim; also a good XML text editor will help you check for missing symbols "{} (), etc" that can convert your pleasant XML coding in a real nightmare.


Tom
 
Tom,
Actually this method cannot be more simple in the C++ front; with a single conversion function you solve everything.
And the XML part is easy as well, as I showed you. I know you will understand it as soon as you go deep into digesting XML scripts.

Suppose that I am, passing a 6 char string in a single, numeric LVAR is as simple as shown in my former posts. No need of BCD conversions, extra C++ functions or weird XML decodings.

As I wrote, I understood you're sharing LVar(s) between different INS units, is that correct? If not then all my comments are not valid as I'm not aware of what your actual solution implies (and sorry for that) nor how simpler/more efficient it would be compared to my technique (if it works).

If yes (uses shared LVars) then I must point out that, due to the way CIVA INS gauges have been implemented (and I'm not willing to touch that because it would be a major rework), it would be a nightmare for me to "share" a variable between separate INS units. That's why I am more inclined to use per-unit variables, it makes my life much simpler.
Ok, then if you want a single LVAR for each string you will need 3 LVars for unit, total 9 LVars for 3 units plus another group of LVARs for decimal signs, Coordinate signs and degree signs. Am I right?

You're 150% right Sir! This perfectly matches the way CIVA handles the L/R Data and FromTo displays strings which are separate from degree/decimal "dots" and separate from the N/S/W/E icons. Connecting them together would be again quite complex on the C++ side.
I appreciate your efforts to find the best solution dealing with a "language" (XML) that you don't dominate yet, but at the same time I feel it's a shame that you are going to invest a lot of time trying to figure out a method that perhaps you think is complex when it is really not.

Dominate? LOL! I'm not even able to read it! I know this will NEVER happen! :rotfl:
I just like to take challenges, the harder the better, and try not to give up. Plus knowing that once I'll end up stuck somewhere I have the chance to rely on gurus like you, willing to help, it's like trying to cross the ocean with a small boat knowing there is always an helicopter ready to save you.
Will I waste a lot of time? Very probably yes!
a good XML text editor will help you check for missing symbols "{} (), etc"

Already using N++ for that, thanks for the suggestion!

As usual, and once again, Thank You!
Marco
 
Marco,

If yes (uses shared LVars) then I must point out that, due to the way CIVA INS gauges have been implemented (and I'm not willing to touch that because it would be a major rework), it would be a nightmare for me to "share" a variable between separate INS units. That's why I am more inclined to use per-unit variables, it makes my life much simpler.

Tell me, can each one of your CDU units call a single master function passing the string of data to assign to an LVAR? Even if the CDUs are coded in different .gau/dll files, the same LVAR can be read/updated in each CDU, it is shared by all the panelset members (XML, C++ and MDL files). Even though you may construct a string for displaying data, the numeric value used can be passed to the function as well if that would be code preferable. So you'll have three functions in different gauges updating the same LVAR-the order of update does count here indeed.

You're 150% right Sir! This perfectly matches the way CIVA handles the L/R Data and FromTo displays strings which are separate from degree/decimal "dots" and separate from the N/S/W/E icons. Connecting them together would be again quite complex on the C++ side.

The logic in this case is almost identical to the pointed out above, only that different LVARs with the complete string value are used for each CDU.

And you don't really need to give me thanks, I could never have done my INS without the help of all your CIVA documents and examples.

Tom
 
I need probably to explain how things are "internally" organized:
CIVA provides a C/C++ SDK and, apart providing some (few) APIs, what's really new in the version to come is that it exports a shared memory area containing every bit of info available to CIVA "proprietary" CDUs and MSUs (ADEU is missing I must admit :rolleyes:).

So I implanted, in the CIVA gauges, internal API calls to keep this memory area in synch with the inner CIVA states/variables.

And I'm NOT going to touch the gauges any more (not considering a couple of fixes and, if time will permit...and if I'll be able, as autonomous, PID based, steering controller, SOMEBODY :) suggested me to implement, to avoid abusing of default FS A/P HDG mode).

But such shared memory area is obviously available only if you code in C/C++.

So I am right now building (I should say "trying to build") a separate .gau using data FROM the shared memory area to feed LVars, and I'm calling it the "bridge".

This is more or less the big picture.

Just to give an idea of the data contained into the shared memory area here is a preview of its structure:

Code:
//
// Left and Right Data Display Descriptor
//
typedef  struct cdu_data_display_tag {

            int   iChangeCounterFlag;  // Incremented every time data is modified
            char  szString [ 8 ];      // Display text (NULL terminated)
            int   iIconId;             // N/S or E/W icons (0=None, 1=N/E, 2=S/W)
            int   iUpperDot1;          // first upper "dot" *RIGHTMOST*
            int   iUpperDot2;          // second upper "dot"
            int   iLowerDot1;          // first lower "dot" *RIGHTMOST*
            int   iLowerDot2;          // second lower "dot"

         } INSDATADSP, * PINSDATADSP;

//
// FromTo Display Descriptor
//
typedef  struct cdu_fromto_display_tag {

            int   iChangeCounterFlag;  // Incremented every time data is modified
            char  szString [ 3 ];      // 2 chars + NULL Term.
            BOOL  bBlinkingOn;         // FALSE=Visible TRUE=Blanked out

         } INSFTDSP, * PINSFTDSP;

//
// MSU State
//       
typedef  struct msu_state_data_tag {

            int   iChangeCounterFlag;              // Incremented every time data is modified
            int   iModeSelectorPosition;           // See MODESELPOS_*
            BOOL  bNavReadyLight;
            BOOL  bBatLight;

         } MSUSTATE, * PMSUSTATE;
       
//
// CDU State
//       
typedef  struct cdu_state_data_tag {

            int         iChangeCounterFlag;        // Incremented every time data is modified
          
            int         iDataSelectorPosition;     // See DATASELPOS_*
            int         iAutoManSelectorPosition;  // See AUTOMANSELPOS_*

            INSDATADSP  tLeftDataDisplay;
            INSDATADSP  tRightDataDisplay;
            INSFTDSP    tFromToDisplay;
          
            int         iLightDimLevel;
            int         iSelectedWpDmeNum;            // 0~9
          
            BOOL        bHoldLight;
            BOOL        bRemoteLight;
            BOOL        bInsertLight;
            BOOL        bAlertLight;
            BOOL        bBatLight;
            BOOL        bWarningLight;
            BOOL        bWyptChgLight;
          
         } CDUSTATE, * PCDUSTATE;


//
// INS Data Descriptor
// One INS Descriptor is available for EACH INS Unit (so up to 3)
//
typedef  struct ins_msu_cdu_state_tag {

            BOOL           bInstalled;
            BOOL           bOn;
          
            MSUSTATE       tMsu;
            CDUSTATE       tCdu;
          
            BOOL           bDmeUpdateActive;    // NOT Valid for INS 3
            BOOL           bApConnected;        // TRUE=Connected to Autopilot
            BOOL           bBatParallelState;   // Valid ONLY for INS 3
            BOOL           bTestMode;           // TRUE=Test pressed

         } INUSTATE, * PINUSTATE;

Now coming back to your questions:
can each one of your CDU units call a single master function passing the string of data to assign to an LVAR?
Definitely Yes! Not each CDU but the bridge can easily do that!

the order of update does count here indeed
I agree, this is a gray area!

And you don't really need to give me thanks, I could never have done my INS without the help of all your CIVA documents and examples.
I couldn't have either without the help from Gianfranco Corrias, real world Alitalia F/E on Classic 747s!

Anyway I thank you once more. See, you're too wasting a lot of time dealing with me! :)
 
Marco,

Thank you for posting those structures.
As I suspected, making the C++ side would be pretty simple. I will post an example so that you can check and have a better understanding on what I meant so far.

Only I need to know, would you like one LVAR per display, or one LVAR per digit?:scratchch And coordinate icons and dots in separate LVARs, right?.

Tom

PS: In the example I would assume INSDATADSP * CDUnLDisp and INSDATADSP * CDUnRDisp for left and right data displays, and the same idea for the other stuctures, being n units 1 to 3. Is this ok?
 
Tom,

Marco,
Only I need to know, would you like one LVAR per display, or one LVAR per digit?:scratchch And coordinate icons and dots in separate LVARs, right?.
If possible the preferred solution would be one LVar per Display.

In the example I would assume INSDATADSP * CDUnLDisp and INSDATADSP * CDUnRDisp for left and right data displays, and the same idea for the other stuctures, being n units 1 to 3. Is this ok?
Sorry but I don't get it.
But looking at the code I posted I probably missed one important detail....
There are 3 "INUSTATE" structure in the shared memory and you retrieve the one you need/prefer/require by calling:
PINUSTATE InsGetInuData ( enum INSUNIT iUnitId );
If you're taking about LVar "naming convention" the one I adopted so far is:

"Civa + Gauge + Item : INS#"

So, for example, for INS #1:

MSU:

"CivaMsuBatLight:1"
"CivaMsuNavLight:1"
"CivaMsuModeSelectorPosition:1"

CDU:

"CivaCduHoldLight:1" ,
"CivaCduRemoteLight:1"
"CivaCduInsertLight:1"
"CivaCduAlertLight:1"
"CivaCduBatLight:1"
"CivaCduWarningLight:1"
"CivaCduWpChgLight:1"
"CivaCduFromToDisplay:1"
"CivaCduFromToDisplay:1"
"CivaCduLeftDataDisplay:1"

You will NOT see a 1:1 correspondence between INUSTATE member and LVars. Just an example: I'll not publish the "INUSTATE.CDUSTATE.INSFTDSP.bBlinkingOn" FTD property, instead, when blinked(-out) I'll set FTD display to 2 blanks so at the end it will appear as blinking. Is that the poor man's blinking method? Yes it is, but I don't care. It is efficient, easy and above all...it works!

BTW if you want to download something interesting see: http://rotate.aero/forum/ata-34-navigation-general/146-carousel-iv-a-ins-operators-manual
It's the operations manual of CIVA but a quite older "firmware" version.

Marco
 
Marco,

Here you have an example on the C++ side:

Code:
#include <string>

PINUSTATE pINU;

// can be placed in a loop as well, verbosed for readingess
pINU = InsGetInuData(1)
fExportToXML(pINU,1)
pINU = InsGetInuData(2)
fExportToXML(pINU,2)
pINU = InsGetInuData(3)
fExportToXML(pINU,3)

void fExportToXML(PINUSTATE pINU, int iUnit)
{
    std::string sUnit = (iUnit==1) ? "1" : (iUnit==2) ? "2" : "3";
    std::string sCivaCduFromToDisplay = "CivaCduFromToDisplay:" + sUnit,
                   sCivaCduLeftDataDisplay = "CivaCduLeftDataDisplay:"+ sUnit,
                   sCivaCduRightDataDisplay = "CivaCduLeftDataDisplay:"+ sUnit;
    std::string  sDataToParse,
                    sChar,
                    sTemplate = "0123456789 LR";
    std::size_t    stFound;

    double dInteger = 0;
    double dFraction = 0;

    // Left Data Display
    // ///////////////////
    sDataToParse = pINU->tCdu.tLeftDataDisplay.szString;

    for (int s=0; s < 6;s++)
    {
        sChar = sDataToParse.substr(s,1);
        stFound = sTemplate.find(sChar);
        if ( stFound != std::string::npos )
        {
            if( s < 3 )
            {       
                dInteger = dInteger + ( (double)stFound * (s==0) ? 10000 : (s==1) ? 100 : 1 );
            }
            else
            {
                dFraction = dFraction + ( (double)stFound * (s==3) ? 10000 : (s==4) ? 100 : 1 );
           
            }
        }
    }
    set_named_variable_typed_value(register_named_variable(sCivaCduLeftDataDisplay.c_str()),(dInteger + (dFraction/1000000)),get_units_enum("number"));   
       
    // RIGHT Data Display
    // ///////////////////
    sDataToParse = pINU->tCdu.tRightDataDisplay.szString;
    dInteger = 0;
    dFraction = 0;
    for (s=0; s < 6;s++)
    {
        sChar = sDataToParse.substr(s,1);
        stFound = sTemplate.find(sChar);
        if ( stFound != std::string::npos )
        {
            if( s < 3 )
            {       
                dInteger = dInteger + ( (double)stFound * (s==0) ? 10000 : (s==1) ? 100 : 1 );
            }
            else
            {
                dFraction = dFraction + ( (double)stFound * (s==3) ? 10000 : (s==4) ? 100 : 1 );
           
            }
        }
    }
    set_named_variable_typed_value(register_named_variable(sCivaCduRightDataDisplay.c_str()),(dInteger + (dFraction/1000000)),get_units_enum("number"));   
         

    // FromTo Display
    // ///////////////////
    sDataToParse = pINU->tCdu.tFromToDisplay.szString;
    dInteger = 0;

    for (s=0; s < 2;s++)
    {
        sChar = sDataToParse.substr(s,1);
        stFound = sTemplate.find(sChar);
        if ( stFound != std::string::npos )
        {
            dInteger = dInteger + ( (double)stFound * (s==0) ? 100 : 1 );
        }
    }
    set_named_variable_typed_value(register_named_variable(sCivaCduFromToDisplay.c_str()),dInteger,get_units_enum("number"));             
}

I only parsed FromTo and both Data Displays, but you can get the idea.
Please notice it is only a snippet, NOT TESTED at all. You'll probably find syntax/casting errors, not difficult to fix.


Then, for example, if Left Display #1 contains "32 99L " (ficticious), (L:CivaCduLeftDataDisplay:1,number) should contains 30210.090911..or perhaps not if I missed something big:D

Later on I can give you the XML side of the story.

Tom
 
Last edited:
Thanks Tom,
I'll try it, hopefully this evening I'll have sufficient time...
In the meantime I tried to implement the BCD decoding routine in XML.
I haven't tried it yet, I just wrote it this morning, can you tell me if this makes any sense?

Code:
<Macro Name="PseudoBcdValueToChar">
      (@1, number) < 10 if{ @1 0x30 + } els{
      (@1, number) == 10 if{ 0x20 } els{
      (@1, number) == 11 if{ 0x4c } els{ 0x3f }}}
</Macro>

Be patient with me please! :(
 
Revised code...
Code:
<Macro Name="PseudoBcdValueToChar">
      (@1, number) 10 < if{ @1 0x30 + } els{
      (@1, number) 10 == if{ 0x20 } els{
      (@1, number) 11 == if{ 0x4c } els{ 0x3f } } } }
</Macro>
 
Tom,
Code:
if( s < 3 )
{     
    dInteger = dInteger + ( (double)stFound * (s==0) ? 10000 : (s==1) ? 100 : 1 );
}
else
{
    dFraction = dFraction + ( (double)stFound * (s==3) ? 10000 : (s==4) ? 100 : 1 );
}

This is the "core" part of your encoding, right? Now things are much more clear to me!
At the end it's not that different from "pseudo BCD" encoding...you do it by multiplying instead of "bit shifting" but bit shifting is actually a different way of multiplying, only your version is decimal my version is hex.
The interesting part is that your solution takes advantage of the floating point part of the FLOAT64, while mine fights against it. But I guess the big difference is that your solution works while mine probably does not! :)
 
Marco,

As promised, the XML part might be something like:

Code:
<Macro Name="u">1</Macro>
<!--

   Reorder macros for different units!!!

<Macro Name="u">2</Macro>
<Macro Name="u">3</Macro>

-->

<Macro Name="StrChar">'R' 'L' ' ' '9' '8' '7' '6' '5' '4' '3' '2' '1' '0' 13 @1 case</Macro>

<Macro Name="ParseVar">
     l0 10000 / int sp1 @StrChar(l1) sp1
     l0 10000 / 1 % 100 * int sp2 @StrChar(l2) l1 r scat sp2
     l0 100 / 1 % 100 * int sp3 @StrChar(l3) l2 r scat sp3
     l0 1 % 1000000 * sp0
     l0 10000 / int sp4 @StrChar(l4) l3 r scat sp4
     l0 10000 / 1 % 100 * int sp5 @StrChar(l5) l4 r scat sp5
     l0 100 / 1 % 100 * near sp6 @StrChar(l6) l5 r scat
</Macro>    
  
<Update>
    (L:CivaCduLeftDataDisplay:@u,number) sp0 @ParseVar sp10
    (L:CivaCduRightDataDisplay:@u,number) sp0 @ParseVar sp11
    (L:CivaCduFromToDisplay:@u,number) sp0 @ParseVar sp12
</Update>

<Element Name="LEFT DATA DISPLAY">  
    <Position X="x" Y="y"/>      
    <FormattedText X="x" Y="y" Font="font" FontSize="size" LineSpacing="spacing" Color="color" Bright="Yes">
        <String>%(l10)%!s!</String>
    </FormattedText>
</Element>      

<Element Name="RIGHT DATA DISPLAY">  
    <Position X="x" Y="y"/>      
    <FormattedText X="x" Y="y" Font="font" FontSize="size" LineSpacing="spacing" Color="color" Bright="Yes">
        <String>%(l11)%!s!</String>
    </FormattedText>
</Element>      

<Element Name="TO FROM">  
    <Position X="x" Y="y"/>      
    <FormattedText X="x" Y="y" Font="font" FontSize="size" LineSpacing="spacing" Color="color" Bright="Yes">
        <String>%(l12)%!s!</String>
    </FormattedText>
</Element>

Like the C++ example, this was done on the paper only, NOT TESTED at all, but (I hope:)) you get the idea.

Two extra things BTW.

1) The macros you posted contain errors.
2) Thank you for the link to the CIVA manual. It happens that I had it already (purchased), and I'm using it as the reference in the DC8 units.

The bitwise method using hex values sounds interesting to me as well. I'll be happy that you post your advances if you finally decide to follow that road.

Tom
 
Tom,

Like the C++ example, this was done on the paper only, NOT TESTED at all, but (I hope:)) you get the idea.
C++ is easy for me while the XML side will be extremely difficult to understand (especially stack based operations) but I will try. Will report back "soon" (it will take few days I fear)!

Thank you very much!
Marco
 
Back
Top