PhilippeV8 Posted February 4, 2006 Report Posted February 4, 2006 Hy Pete, I am having a bit of problems with the data types and conversion. (C++) Could it be possible to get an example of a code which reads the NAV1 frequency from fsuipc and then puts it in a label or textbox ? That would be quite handy. The SDK example from C/C++ doesn't explain me really how to do that.
Pete Dowson Posted February 4, 2006 Report Posted February 4, 2006 Could it be possible to get an example of a code which reads the NAV1 frequency from fsuipc and then puts it in a label or textbox ? That would be quite handy. The SDK example from C/C++ doesn't explain me really how to do that. What sort of explanation is really needed? The format of the frequencies is explained in the Programmer's guide. They are all simple 16 bit words -- i.e. type "unsigned short" both in C and C++. Read then into such (length 2). They are in binary-coded decimal, which simply means that each group of 4 bits represents one decimal digit. For display it is easiest to simply convert them to hex character form, using the printf "%X" facility. For instance, if the frequency is actually 112.75 the value you get, in hex, is 0x1275 (the 100 digit is assumed). To print that you'd simply do a printf with "1%02X.%02X" (to put the decimal point in correctly), with parameters (val >> 8) and (val & 0xff). None of this is complex programming, just basic C. (I don't know C++, sorry). If you can say why you cannot understand then maybe I can see what is wrong with the documentation, but having someone do the code for you doesn't help anyone in the long term. Regards, Pete
PhilippeV8 Posted February 6, 2006 Author Report Posted February 6, 2006 Pete, The info you gave helped someone else to give me some code which now works. So thanks for that. You say that getting code is not helping one to understand or learn .. that's true .. but my phylosophy is that I don't need to knox exact how it works .. as long as it does work and I know how to mold it so that I can use it. After a while I understand by doing and using the code. That's a total different approach than you suggest .. taking a book and learning 'bout program languages. But I think that would take me way too far and take me way too much time doing/learning things I don't need to know. It's a different phylosophy I guess. Either way, the thing I want to acoumplishe is nearly finished and it'll work for me. So I'm happy. Tnx
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