FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
02-08-2022 10:56 AM - edited 02-08-2022 10:59 AM
I want to write a negative value to a paramter on the CtrlX Drive. Via Drive Engineering a decimal number can be written to the parameter which can be negative. This is not possible via the C++ interface, because there the number to write is a vector of byte, which holds no information about the number being positive or negative. Is it possible to write negative number via the C++ interface on the CtrlX and if yes how?
In my particular case it is the paramter "S-0-0052, Reference distance of encoder 1". This parameter can be positive and negative.
Its format is DEC_MV(Signed decimal number). But in the C++ interface the data to send is a vector of uint8_t so a vector of unsigned numbers. Is there a logical conversion to a negative number? I have tried to set the first bit to 1, representing the minus bit for a signed, but this does not work.
auto data__ = data ? _fbb.CreateVector<uint8_t>(*data)
Solved! Go to Solution.
02-09-2022 09:52 AM
Changing only the first bit could be not enough depending on the data size. Here an example simply made with the calculator: