August 22, 200421 yr Hi everyone,I'm programming a little apps using FSUIPC to read and writes values for the avionics stack.The reading is OK and increasing COM value is OK too, but when decreasing, the value keep circling in a 6 loop.Ex. 9093, 9092, 9091, 9090, 9089, 9088 and then 9093 instead of 9087!!The program work as follow:1- read com1 value and put result in a variable2- decrease the variable value3- writes the variable value to com1.The program is in VB but any instructions in C would work OK.Any clues why it works for increasing and not decreasing??Thanks for any help
August 25, 200421 yr According to FSUIPC manual for offset 311A (a two byte value), "COM1 standby frequency (FS2002 only), 4 digits in BCD format. A frequency of 123.45 is represented by 0x2345. The leading 1 is assumed."So 9093 is frequency 190.93? It makes no sense. What type is the variable you're using to hold the value?
August 26, 200421 yr The numbers I gave are in decimal if you convert them to hex you will get the right frequency.By the way I found the problem, if I read the value, convert it to hexadecimal, increase or decrease the value then reconvert it to decimal and write the result to FSUIPC it works!That's weird if I read the value, increase or decrease and write it back to FSUIPC I get strange behaviors, that's probably got something to do with how VB handles the variable pointers.Well I don't care know, I found a workaround and it's OK now.Thanks anyway
August 26, 200421 yr >that's probably got something to do with how VB handles the variable>pointers.Actually it has something to do with the way YOU handle the variable (it depends on how it is defined, i.e. an integer, byte, etc)! VB can guess on the type of arithmetic function you want to perform if you let it (it is done by default) and does the necessery convertions but that doesn't mean it will always work as YOU want.>Well I don't care know, I found a workaround and it's OK now.True.
Create an account or sign in to comment