jimthomasjohnston Posted August 16, 2008 Report Posted August 16, 2008 Pete, Just a quick question; Can offsets 66C0 to 66FF be used with U16 (2 bytes), or just U8 (a single bit)? I am using GFDisplay, and wish to display 9 different items on my GF-46, as described in the manual... [Conditions] 1=x66C0 U16 =0 ; Altimeter 2=x66C0 U16 =1 ; % MAC 3=x66C0 U16 =2 ; Autobrake 4=x66C0 U16 =3 ; Transponder 5=x66C0 U16 =4 ; ADF1 6=x66C0 U16 =5 ; ADF2 7=x66C0 U16 =6 ; Zero Fuel Wt 8=x66C0 U16 =7 ; Land Field Altitude 9=x66C0 U16 =8 ; Planned Flt Altitude Jim
Pete Dowson Posted August 16, 2008 Report Posted August 16, 2008 Just a quick question; Can offsets 66C0 to 66FF be used with U16 (2 bytes), or just U8 (a single bit)? I am using GFDisplay, and wish to display 9 different items on my GF-46, as described in the manual... Whatever you like. Each of the bytes from 66C0 to 66FF contain 8 bits, which is what "byte" means -- an addressable set of 8 bits. The units named "U8", "U16", "U32", for 8, 16 and 32 bits, and so on, only determine how you USE them, not what they are! If you address 66C0 as a U16 you are referring to the two bytes at 66C0 and 66C1. With a U32 you are referring to the 4 bytes at 66C0 through to and including 66C3. In other words, you can refer to the data in groups of 8 bits or 16 or 32. it doesn't matter. You use whatever is more suitable to your purpose. Pete
jimthomasjohnston Posted August 16, 2008 Author Report Posted August 16, 2008 Thanks Pete... I guess the question I should have asked is "how may bits does each offset in the range contain?" Having said that, will the following line in FSUIPC cycle through all 9 bits (8 bits in 66C0 and 1st bit in 66C1) using Joy125, Btn0? If not, what will?: 299=P125,0,Cx510066C0,x00080001 Jim
Pete Dowson Posted August 17, 2008 Report Posted August 17, 2008 I guess the question I should have asked is "how may bits does each offset in the range contain?" Again, that depends how you use it. Each addressable byte contains 8 bits, by definition, but the same addresses (offsets) can be accessed as Words (2-byte or 16-bits), Dwords (4-byte or 32 bits) or even 64-bit values where supported by the programming language used. Then there's 32-bit floating point and 64-bit double floating point numbers. Any of these can be addresses at any offset value. You choose the method suited to the data being contained and manipulated. Having said that, will the following line in FSUIPC cycle through all 9 bits (8 bits in 66C0 and 1st bit in 66C1) using Joy125, Btn0? If not, what will?:299=P125,0,Cx510066C0,x00080001 Not by single bit, no, and not with 9 bits. There are two errors here. 1. The command is "byte cyclic increment", and a Byte contains only 8 bits, so the 9th bit doesn't exist for it and cannot be reached. To deal with a word (16 bits) you'd need the x52....... command for "Word cyclic increment". Please see my previous explanations of what bytes and words are. 2. "Increment" here implies ADDITION. so each button press will add the increment you specified - i.e. 1 - until reaching your limit, i.e. 8, then cycle back to 0. So you will get values 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2 .... etc. These are NOT "bits". For separate bit settings you'd need 1, 2, 4, 8, 16, 32, .... 512 (for 9 separate bits). This is not "incrementing" but "doubling" or "multiplying by 2". You need to understand a bit more about numbers. If you don't understand binary, consider decimals. your need, if it were in decimal, would be for numbers 1, 10, 100, 1000, 10000,100000000. To get from one to the next you have to multiply by 10, right? Not add 1! It's the same with binary numbers except the multiplier is 2. What you appear to want to do cannot be done with any control offered by FSUIPC at present I'm afraid. I'm looking at adding LUA programming facilities in the next version, though, and then you could do almost anything (but you'd need to lean LUA first). However, looking at your original message, you don't appear to want "bits" at all, but "numbers", numbers 0 through to 8. Why are you talking about and worrying about bits in the first place? Regards Pete
jimthomasjohnston Posted August 17, 2008 Author Report Posted August 17, 2008 Pete, Thanks again for your quick reply and for setting me straight. I just "assumed" that "299=P125,0,Cx510066C0,x00080001" cycled through "bits", but, right you are...it cycles through the value in the byte at offset 66C0. So, is it possible to cycle through more then 8 values "0-7", as I would like to cycle through 9 values, "0-8"? If I am understanding you correctly (if I can even convince myself that I understand this stuff at all :D ) then in order to cycle through values 0-8, as I will need for my display, I will require the following line "299=P125,0,Cx520066C0,x00080001" in order to cycle the value in the byte at offset 66C0 from 0-8 using Joy125, Btn 0. Jim
Pete Dowson Posted August 17, 2008 Report Posted August 17, 2008 Thanks again for your quick reply and for setting me straight. I just "assumed" that "299=P125,0,Cx510066C0,x00080001" cycled through "bits", but, right you are...it cycles through the value in the byte at offset 66C0. So, is it possible to cycle through more then 8 values "0-7", as I would like to cycle through 9 values, "0-8"? Yes, just change the upper limit (the 8 in x00080001). In one byte you can cycler through as many as 256 values (8 bits gives a 0-255 capacity, or 00 to FF in hexadecimal). If you need more than 256 you'd need to use the Word increment, giving you up to 65535 (hex FFFF). If I am understanding you correctly (if I can even convince myself that I understand this stuff at all :D ) then in order to cycle through values 0-8, as I will need for my display, I will require the following line "299=P125,0,Cx520066C0,x00080001" in order to cycle the value in the byte at offset 66C0 from 0-8 using Joy125, Btn 0. No, all you've changed there is using 2 bytes (16-bits) instead of one. Since the value "8" easily fits in one byte of 8 bits (capacity 256 values), the original command is fine. I'm afraid I don't recall whether the limit provided is INCLUDED or EXCLUDED. I don't use this stuff and the code dates back many years. Have you tried it? That's what I would do -- it is quicker than trying to work out what old code does! If it cycles back to 0 after 7, just make the limit 9 instead of 8. Pete
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