braunewell Posted April 9, 2003 Report Share Posted April 9, 2003 Hi guys, as the FSUIPC Documentation or FS interrogate says, i extract the offset &H07F2. The results are ok as far as i have a positive climbrate in the FS (like 2200). But when i change the rate to a negative value, the offset delivers a value like for example 65436 for a descentrate of -100 ft. Has anyone a idea how to work with that? Thanks Stefan Link to comment Share on other sites More sharing options...
braunewell Posted April 9, 2003 Author Report Share Posted April 9, 2003 Hi guys, as the FSUIPC Documentation or FS interrogate says, i extract the offset &H07F2. The results are ok as far as i have a positive climbrate in the FS (like 2200). But when i change the rate to a negative value, the offset delivers a value like for example 65436 for a descentrate of -100 ft. Has anyone a idea how to work with that? Thanks Stefan Link to comment Share on other sites More sharing options...
hastim Posted April 9, 2003 Report Share Posted April 9, 2003 stefan, That is how negatives are held in a 2 byte (word). if you copy this to an integer variable you should get -100. Mark Link to comment Share on other sites More sharing options...
hastim Posted April 9, 2003 Report Share Posted April 9, 2003 stefan, That is how negatives are held in a 2 byte (word). if you copy this to an integer variable you should get -100. Mark Link to comment Share on other sites More sharing options...
braunewell Posted April 10, 2003 Author Report Share Posted April 10, 2003 Hi Mark, i have tried that out, copying the value from the offset to a long variable (int is too short) and it is not working. How would you copy? may i have an example? thanks stefan Link to comment Share on other sites More sharing options...
braunewell Posted April 10, 2003 Author Report Share Posted April 10, 2003 Hi Mark, i have tried that out, copying the value from the offset to a long variable (int is too short) and it is not working. How would you copy? may i have an example? thanks stefan Link to comment Share on other sites More sharing options...
Chris Brett Posted April 10, 2003 Report Share Posted April 10, 2003 Or you could do (pseudo code): if value from IPC > 32737 then VS := value - 65535 else VS := value; ... in the absence of knowing what the VB equivalent of a signed word is. It's a bit crude but it'll do the job. Chris Link to comment Share on other sites More sharing options...
Chris Brett Posted April 10, 2003 Report Share Posted April 10, 2003 Or you could do (pseudo code): if value from IPC > 32737 then VS := value - 65535 else VS := value; ... in the absence of knowing what the VB equivalent of a signed word is. It's a bit crude but it'll do the job. Chris Link to comment Share on other sites More sharing options...
jcboliveira Posted April 10, 2003 Report Share Posted April 10, 2003 Why the long? The var is 2 byte long. I think that if you pass a long the two most signigficant bytes will be 0 on return (or something that is on 0z7f4 0x7f5 I don't know) and the negative numbers will be intrepreted as positive like in the word. If you need a long for after processing you must cast the result to it after retrieving. Best José Link to comment Share on other sites More sharing options...
jcboliveira Posted April 10, 2003 Report Share Posted April 10, 2003 Why the long? The var is 2 byte long. I think that if you pass a long the two most signigficant bytes will be 0 on return (or something that is on 0z7f4 0x7f5 I don't know) and the negative numbers will be intrepreted as positive like in the word. If you need a long for after processing you must cast the result to it after retrieving. Best José Link to comment Share on other sites More sharing options...
hastim Posted April 11, 2003 Report Share Posted April 11, 2003 I use Delphi and also not sure of the VB var equivalent. So if you're still having problems, I'd go with Chris' example... It will work... Mark Link to comment Share on other sites More sharing options...
hastim Posted April 11, 2003 Report Share Posted April 11, 2003 I use Delphi and also not sure of the VB var equivalent. So if you're still having problems, I'd go with Chris' example... It will work... Mark Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now