Hi All,
I find that I can't use int8(*) to convert the raw type to int8. Pls see below:
int8 Angle_int;
smRead(VariableIDs.Angle, Angle_int); //////////////////VariablesIDs.Angle from can.
smWrite(VariableIDs.MedVariable, Angle_int);
processScreenApi();
The result of MedVariable is not correct!
Is there anyone can help me out?
Can we convert type by int8(*) in script ?
- TimTian
- Posts: 22
- Joined: Wed Sep 25, 2013 10:26 pm
- ksaenz
- Enovation Controls Development
- Posts: 263
- Joined: Thu Aug 19, 2010 7:53 am
Re: Can we convert type by int8(*) in script ?
Hello TimTian,
You can try this functions to convert betweend signed and unsigned variables:
Regards,
ksaenz
You can try this functions to convert betweend signed and unsigned variables:
Code: Select all
double utos( double x )
{
uint16 u;
int16 s;
u = x;
s = u & 0xFFFF;
x = s;
return x;
}
double stou( double x )
{
uint16 u;
int16 s;
s = x;
u = s & 0xFFFF;
x = u;
return x;
}
ksaenz