Using VariableID as Pointer

Discuss issues and ideas you have to configuring displays with PowerVision
CustomFP
Posts: 41
Joined: Thu Mar 22, 2012 4:12 pm

Using VariableID as Pointer

Post by CustomFP » Sun Jan 29, 2017 10:46 pm

Given that VariableID is a uint.
Can I use save a VariableID to a unit varaible then use this like a pointer.
i.e

void main
{
uint a = VariableIDs.example;
float b;
smRead(a,b);

}

I am trying to make a CANBUS read/write buffer, and this would allow me to queue system variables in the buffer.
boyce
Enovation Controls Development
Enovation Controls Development
Posts: 322
Joined: Wed Sep 08, 2010 5:09 pm

Re: Using VariableID as Pointer

Post by boyce » Tue Jan 31, 2017 4:58 pm

Yes, that looks like it will work fine. Since you are doing a queue, you can use an array for your buffer. Something like:

void main
{
uint a;
double[] b(20);
a = VariableIDs.example;

// Your code could have a loop and an index.
smRead(a, b[0]);
smRead(a, b[1]);

}
Boyce Schrack
Enovation Controls