Hukken
-
Posts
3 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Gallery
Downloads
Posts posted by Hukken
-
-
Hi Pete,
Thank you for the reply.
8 hours ago, Pete Dowson said:Assuming you meant "hexadecimal", then all vlaues are supplied as numbers
Correct
8 hours ago, Pete Dowson said:No. A number is only in "decimal" if it is converted into a decimal string using "string.format" or attached to a string. All numbers in computers are in binary -- i.e. strings of bits. This is fundamental to any understanding of programming. If you want hexadecimal strings you use a string.format with the %X facility.
However, if you want to test or manipulate bits, which is what I assume you want to do, you should use the binary number as received. Otherwise you will have a lot more difficulty!
OK, so if I have understand correctly; when the following lines of code outputs 168, it's a binary number? That does not sounds correct?
n = ipc.readUB(50C8) ipc.display(n)
9 hours ago, Pete Dowson said:BTW the programmer of that aircraft seems to have gone out of his way to make it complicated!
I agree one hundred percent!!
-
Hi.
I'll get straight to the point: In LUA, is it possible to to read Offset data as sexadecimals?I'm asking because I'm trying to set up some external engine gauges for the Majestic Dash 8 300, and in the manual it states:
////////////////////////////////////////////////////////////////////////////////// // To be received via offsets 50C8 to 50DF // For Engine Data, value=0X0 to 0XA (where 0X0 to 0X9 is the digit and 0XA is a blank digit) . // For Engine Data, Digit 0 in bites 0,1,2 & 3 of Byte 0; Digit 1 in bites 4,5,6 & 7 of Byte 0; // For Engine Data, Digit 2 in bites 0,1,2 & 3 of Byte 1; Digit 3 in bites 4,5,6 & 7 of Byte 1; // Example for Engine Data: NH1, value 88.5 would be: Byte 0 = 0XA8, Byte 1 =0X85. ////////////////////////////////////////////////////////////////////////////////// Description Offsets and range NH1 Offsets 50C8 & 50C9….range 000.0 to 199.9 TRQ1 Offsets 50CA & 50CB….range 000.0 to 199.9 FF1 Offsets 50CC & 50CD….range 0000 to 1999 PROP1 Offsets 50CE & 50CF….range 000.0 to 199.9 NL1 Offsets 50D0 & 50D1….range 000.0 to 199.9 ITT1 Offsets 50D2 & 50D3….range 0000 to 1999
So I guess I need the offset values available as hexadecimals in strings.
When using ipc.readSB(offset) the value is only available as decimal number.
Question about LUA and offset vlues
in FSUIPC Support Pete Dowson Modules
Posted · Edited by Hukken
You probably right. But despite my lacking knowlegde on basic computer numbers, I've now manged to extract the relevant values from the SIM and done the necessary processing in Lua. Now, with the correct values I can go back to the original program which is to set up some external gauge in Air Manager.
Anyway, thanks for your inputs Pete. I got what I needed, and still learned some basic computer numbers! ;)