SpiekerHoiting Posted October 4, 2023 Report Posted October 4, 2023 Hello, is there anybody who wrote code to read Arinc429Word in Visual Basic? I'm programming ECAM screens to run on a network computer as an alternative to Project Magenta. All's going well until I encounter Arinc429Word-vars. I can read the values usins FSUIPC; they're LVARs, as integers. But they should be read as 32 bits binaries I believe.. I'm stuck..
John Dowson Posted October 5, 2023 Report Posted October 5, 2023 I don't know anything about Arinc429 (and am not familiar with VB either!) , but you should be able to read an lvar and convert it to whatever data type you need. An lvar can hold any data type to a maximum of 8-bytes. What version of FSUIPC are you using, and how are you getting the lvar value? If you are reading as a integer, which I presume is 4-bytes/32-bits, can you not just convert that to a 32-bit binary data type?
SpiekerHoiting Posted October 5, 2023 Author Report Posted October 5, 2023 Hi John, I use a registered version of FSUIPC7. I read the value through simconnect (fsx_simconnect.AddToDataDefinition(StructDefinitions.Struct1, "L:A32NX_APU_EGT", "", Microsoft.FlightSimulator.SimConnect.SIMCONNECT_DATATYPE.FLOAT64, 0, 61), but now I have to figure out how to translate that to a 32 bits-Binary. Arinc429 is difficult because only part of the 32 bits are data. Other parts are parity(?)/ssm(?)/labels(?)..
John Dowson Posted October 5, 2023 Report Posted October 5, 2023 Ok, so you are using SimConnect, not the FSUIPC SDK. And you are requesting it as a 64-bit/8byte float (SIMCONNECT_DATATYPE.FLOAT64), not an integer/32-bits. All lvars are stored internally as 64-bit floats, but you can covert them to the actual data-type required in your code, but it is up to you to do this. As far as MSFS is concerned, lvars are only numeric - from the SDK documentation: IMPORTANT! "L:" vars can only hold numeric data and nothing else, eg: no strings, no binary values, no structs, etc... With FSUIPC7, you could also add the lvar to a free FSUIPC offset and read it from there (see Advanced User guide for details). 1 hour ago, SpiekerHoiting said: now I have to figure out how to translate that to a 32 bits-Binary. Arinc429 is difficult because only part of the 32 bits are data. Other parts are parity(?)/ssm(?)/labels(?).. Well, it is up to you how you interpret/what to do with the value, I cannot help with that. Looking at the MobiFlightt preset that reads this lvar (A32NX_APU_EGT), the description says: `Arinc429Word<Celsius>`, The APU's exhaust gas temperature,,when < -273.15 the ECB isn't supplying information, for example due to being unpowered. So it looks like they are using a specific datatype/class to handle this. Maybe better to ask the author of this preset (rofl-er) how to interpret this on the MobiFlight Discord channel.
SpiekerHoiting Posted October 6, 2023 Author Report Posted October 6, 2023 Hi John, I took a few hours and some help from someone I met on Discord, but I found it! Dim u64Val As ULong = s1.SC_APUEGT Dim u32Val As UInteger = u64Val And &HFFFFFFFFUI Dim rawData = BitConverter.ToSingle(BitConverter.GetBytes(u32Val), 0) LabelAPUEGT.Text = (Int(rawData).ToString) I'm a happy man and can continue! Thanks for your responses! Greetings, Harrie Hoiting
John Dowson Posted October 6, 2023 Report Posted October 6, 2023 Thanks for the update - glad you found it!
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