895 views
in Embedded Wizard Studio by

Hello Team,

     Now, I can use valuedisplay to show new value on screen.  

 int control = 0;
int DeviceDriver_ProcessData( void )
{
  double value;
  static double PEQ_KNOK_GAIN_SRC[31] = {-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0.0,1.0,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
   if ( ValueDisplay != control )
  {
    ApplicationDeviceClass device = EwGetAutoObject( &ApplicationDevice,
                                                      ApplicationDeviceClass );
     value = PEQ_KNOK_GAIN_SRC[ValueDisplay];
    ApplicationDeviceClass__UpdateValueDisplay( device, (XInt32)value);
    control++;
    return 1;
  }
  return 0;
}

If I want to read this array on the embedded wizard stdio.You may know I  use text view as a value to make line before,and use text view to read the current value .

var float g = (float)Application::Device.PEQ_GAIN1[PEQ_GAIN.Sider.CurrentValue];
var float q = (float)Application::Device.PEQ_Q1[PEQ_Q.Sider.CurrentValue];
var float f = (float)Application::Device.PEQ_FREQ1[PEQ_FREQ.Sider.CurrentValue];

Question:Can I use ValueDisplay to read external arrays(PEQ_KNOK_GAIN_SRC) and operate on embedded wizard stdio to calculate?If so, how can I get?

Best regards,

Tonny

1 Answer

0 votes
by

Hello Tonny,

I'm sorry, but I do not understand what you mean. If you want to exchange data via arrays then the section Exchange array contents provides you hints how to do this.

Best regards

Paul Banach

by
Hello Paul,

       Thank you very much,I think I should know

Best regards,

Tonny
by

Hello Paul,

       According to what you mean .

var int32 noOfEntries = SomeDataArray.length;
var int32 i;

// Iterate through all entries of the array. Here the variable 'noOfEntries'
// limits the loop.
for ( i = 0; i < noOfEntries; i = i + 1 )
{
  var uint32 val;

  // Within 'native' code read the value 'i' of the array in your main software
  // or middleware. Store the value in the local variable 'val'.
  native ( i, val )
  {
    /* Declaration of an externally available array. In this manner the
       C compiler can access the array without warnings. */
    extern unsigned int PEQ_KNOK_GAIN_SRC[ 31];
    
    val = PEQ_KNOK_GAIN_SRC[ i ];
  }

  // Again in Chora, copy the value from the variable 'val' to an array
  // member existing in 'this' object
  SomeDataArray[ i ] = val;
}

But I still don't know the SomeDataArray define,for example:Is it like this ?

If i want to use peq_try array instead of PEQ_KNOK_GAIN_SRC[31] value,What should i do?Could you give me some details ?Thanks!

Best regards

Tonny

by

Hello Tonny,

yes, in this approach SomeDataArray stands for an array member, e.g. peq_try. The array PEQ_KNOK_GAIN_SRC (or in the original example the array YourDeviceArray) represents some C array in the device. The example shows how to transfer data from the C array to an array existing in Chora.

Does it help you?

Best regards

Paul Banach

Ask Embedded Wizard - Archive

Welcome to the Ask Embedded Wizard archive. This community forum served us well for many years, but we've evolved our support approach!

Your resources:

The Embedded Wizard Online Documentation provides comprehensive documentation, tutorials, examples and ready-to-use software packages.

For dedicated assistance, explore our Embedded Wizard Product Support.

You can still browse the valuable discussions from our community history here.

Embedded Wizard Website | Privacy Policy | Imprint

...