ysav Posted August 19, 2004 Report Posted August 19, 2004 My epicinfo.cfg contains an entry MCP_IAS_VAR=4,1 to communicate the Vspeed to Magenta. The value is set in EPIC tru a nqw command. Works ok for positive values however how do I send a negative value ? Thanks. Yves
Pete Dowson Posted August 19, 2004 Report Posted August 19, 2004 My epicinfo.cfg contains an entry MCP_IAS_VAR=4,1 to communicate the Vspeed to Magenta. The value is set in EPIC tru a nqw command. Works ok for positive values however how do I send a negative value ? You surely don't need to set negative V speeds? Anyway, the MCP IAS is not a V speed but the target speed setting for the autothrottle in the MCP. And it cannot be set negative. If you are thinking more of values like the Vertical Speed, then, yes, you need negatives. EPIC doesn't support negative numbers anyway, but if the recipient, as in this case, accepts 16 bit signed numbers then you simply sent the positive equivalent -- it will look negative when it gets there. In most all computers these days negative numbers are represented by what is called "2's complement". This is basically the "NOT" (logical bit reversal) of the positive number, plus 1. For example, in 16 bits: +1 = 0000 0000 0000 0001 -1 = 1111 1111 1111 1111 +120 = 0000 0000 0111 1000 -120 = 1111 1111 1000 1000 Arithmetically you can derive the latter from the former in a 16-bit capable system (like EPIC) by neg = (65535 - pos) + 1 Note that although this looks the same as "65536 - pos" you cannot use 65536 in a 16 bit word as it needs 17 bits. However, the following MAY work: neg = 0 - pos but I'm not sure what sort of checks EPIC applies -- this would "look" negative and it may zero it. I can't remember, but I have a horrible suspicion that it does. Last time I programmed EPIC was years ago. Regards, Pete
ysav Posted August 24, 2004 Author Report Posted August 24, 2004 I meant MCP_VS_VAR for vertical speed. Both assignment forms you have suggested work. Wow ! I was stunned to see neg = 0 - pos work ! It is the simplest form but I kept away from it all that time also thinking Epic couldn't handle negatives. Your help was appreciated. Yves Savard
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