I have written a routing function in which i take the lat/lon from fs and then calculate the heading (in degrees, unsigned) needed to fly over a target lat/lon. I print out the heading in the degrees and it is always correct. However, when i try to convert the heading back into the FS format and write it to the autopilot heading preset, the heading in the autopilot display is a different number. Here is my code for the conversion:
//after heading calculation...
heading = (heading*360)/65536;
mastLock = 1;
headLock = 1;
FSUIPC_Write(0x07BC, 4, &mastLock, &dwResult);
FSUIPC_Write(0x07C8, 4, &headLock, &dwResult);
FSUIPC_Write(0x07CC, 2, &heading, &dwResult);
Everything works fine except for the heading when it appears in the autopilot display. Your help would be greatly appreciated.