braunewell Posted April 9, 2003 Report 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
braunewell Posted April 9, 2003 Author Report 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
hastim Posted April 9, 2003 Report 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
hastim Posted April 9, 2003 Report 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
braunewell Posted April 10, 2003 Author Report 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
braunewell Posted April 10, 2003 Author Report 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
Chris Brett Posted April 10, 2003 Report 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
Chris Brett Posted April 10, 2003 Report 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
jcboliveira Posted April 10, 2003 Report 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é
jcboliveira Posted April 10, 2003 Report 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é
hastim Posted April 11, 2003 Report 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
hastim Posted April 11, 2003 Report 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
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