How to create a structure of Devchan?
winstonma
Posts: 45
I would like to create a structure to Devchan
DEVCHAN abc[] = {{dvTP, 1}, {dvTP, 2}}
Structure SomeStruct
{
DEVCHAN Devchan1
}
149: SomeStruct.Devchan1 = abc
gives me a compilation error:
Someline.axs(149): C10585: Dimension mismatch: [0] vs. [1]
Please kindly show me how to solve this, thanks
by the way I would like to know if do the mutually exclusive on a devchan??
DEVCHAN abc[] = {{dvTP, 1}, {dvTP, 2}}
Structure SomeStruct
{
DEVCHAN Devchan1
}
149: SomeStruct.Devchan1 = abc
gives me a compilation error:
Someline.axs(149): C10585: Dimension mismatch: [0] vs. [1]
Please kindly show me how to solve this, thanks
by the way I would like to know if do the mutually exclusive on a devchan??
0
Comments
Think of a STRUCTURE as an intrinsic data type on steroids. Instead of an INTEGER or CHAR, you now have a data type called SomeStruct.
The reason this line caused an error
SomeStruct.Devchan1 = abc
Is because it?s very similar to something like:
INTEGER = x
which obviously doesn?t hold water. You need a variable to contain the values.
And the line you referenced as your problem:
SomeStruct.Devchan1 = abc
shouldn?t cause a dimension mismatch. It should be just a straight syntax error.
If you did something like:
sMyStruct[1].Devchan1 = abc
then that would cause a dimension mismatch.
Sorry, don?t have any idea what you are asking with this one.
also what i mean is for example I have a devchan is like this...
DevChan abc[] = {{dv1, 1}, {dv1, 2}, {dv1, 3}}
DEFINE_MUTUALLY_EXCLUSIVE
({dv1, 1}, {dv1, 2})
Is it possible to place my devchan in the DEFINE_MUTALLY_EXCLUSIVE?
By the way I can use {dv1, 1}...{dv1, 100} in mutually exclusive... is it possible to use that in devchan definition?
I would think that putting the 'DEVCHAN' in the structure is the issue.
bear in mind that what you have defined in devchan1 is simply a multi-array variable.
You can see this if you paste Devchan1 into the debug window and look at the values.
Devchan1 would be
Devchan1[devcie][port][system][button_number]
You might try something like
Structure SomeStruct
{
INTEGER Devchan1[X][X][X][X]... or whatever it works out to be
}
but then to implement the structure you have a...
DEFINE_VARIABLE
SomeStruct sSomeStruct
statement. So you've come full circle. Only now you have to relate to that variable as
sSomeStruct.Devchan1 instead of just Devchan1
I have to admit, I'm not sure why you'd want to do something like this. It seems somewhat circular. I'm curious as to what you're intending to do...
I suppose you can call it that but it?s really a STRUCT. (devchan1.number, devchan1.port, devchan1.system, and devchan1.chan) You can verify that in the debug window.
Ouchie.
Yes, and now we get into the esoteric nature of variables and how to classify them... I think you are correct in that it is a Structure. It is in the debug window. It can be expressed as a multi-array variable as well. And, yes Ouchie indeed!
The problem here is that abc is an array of devchan's while you're structure only declares a single devchan. If you changed it to to Devchan1[2] it would work I think.
SomeStuct.Anything = something //will never compile.
SomeStruct in winstonma?s code is the definition not a variable.
It?s like trying to say
INTEGER = x //no can do
Also the compile error that winstonma listed can?t be correct either because it should generate a syntax error not a dimension mismatch. Which leads me to believe maybe the original posting was in error to begin with? Of course all this flies out the window if that?s the case.
eg: MASTER_SETTINGS.cEMAIL_SERVER = DATA.TEXT
Note that in the original example the assignment statement isn't in the variable declaration area, but at line 149 which I'm assuming is start or something similar.
Ooops didn't notice that the variable hadn't been declared.... but from the error message about the dimension not matching it looks like perhaps it was declared somewhere.