Jump to content
The simFlight Network Forums

Setting up virtual buttons


Recommended Posts

I am trying to wire the 737 OHD. I have developed the mouse macros for doing so. I have also tested them with keyboard assignments.

I want to use virtual buttons to call them from the interface card i use (SYS3 from FDS).

I need help with 2 things -

a) How does one set up virtual buttons? I understand that i can have upto 288 of them (more than enough for the OHD) and from what i have read my understanding is that these virtual buttons can be 'triggered' by writing to the 3340 FSUIPC Offset. I must confess that i am not completely clear on how to use the 3340 offset.

b) How does one invoke these virtual buttons from an interface card utility? is it via writing to the 3340 offset? My interface card utility allows me to setup FSUIPC "writes" when a physical switch is wired to it and performs an action.

Any help will be much appreciated. Thanks very much in advance.

Best regards,

CPJ

Link to comment
Share on other sites

I am trying to wire the 737 OHD. I have developed the mouse macros for doing so. I have also tested them with keyboard assignments.

I want to use virtual buttons to call them from the interface card i use (SYS3 from FDS).

Okay.

I need help with 2 things -

a) How does one set up virtual buttons? I understand that i can have upto 288 of them (more than enough for the OHD) and from what i have read my understanding is that these virtual buttons can be 'triggered' by writing to the 3340 FSUIPC Offset. I must confess that i am not completely clear on how to use the 3340 offset.

All that happens in the 288 bits starting at offset 3340 is that each bit (binary digit) represents one button or switch. When the bit is 1 that particular button or switch is pressed or on. When it is 0 it is released or off.

Because of how PC processors are designed, the 288 bits are, for access, divided into 8-bit bytes. So that is 36 bytes (36 x 8 = 288, right?).

Each byte can be addressed by its offset -- 3340 for the first, 3341 for the second, and so on, up to 3363 for the 36th (36 is "24" in hexadecimal, and offset addresses are in hexadecimal: 3340 + 24 = 3364, all in hex).

A byte is the smallest unit you can read or write, so to operate a single button/switch, you actually have to READ the byte, change the one bit out of the 8 which you wish to affect, and WRITE the byte back. If the software you are using can do this (they might refer to it a "toggling" or "exclusive or'ing") then you are all set. It may require you to provide a mask -- 1 for the first bit in a byte, 2 for the next, 4 for the next and so on, up to 128 (decimal) for the 8th.

b) How does one invoke these virtual buttons from an interface card utility? is it via writing to the 3340 offset? My interface card utility allows me to setup FSUIPC "writes" when a physical switch is wired to it and performs an action.

Does the utility provide any facility to change an offset other than simply write to it? For instance, doesn't it provide for incrementing a value? Changing bits in a value? A lot of the FSUIPC offsets are bit-oriented, so it should be something the utility's author made allowances for?

Regards

Pete

Link to comment
Share on other sites

Pete:

Thanks very much.

Does the utility provide any facility to change an offset other than simply write to it? For instance, doesn't it provide for incrementing a value? Changing bits in a value? A lot of the FSUIPC offsets are bit-oriented, so it should be something the utility's author made allowances for?

First it asks for which offset.

Then the Operation - it provides the following options -

Decrement value

Increment value

Clear bit

Set bit

Set bit then reset

Set value

Set value then zero

Toggle bit

------------------------------------

Also - before i setup this offset and operation in the sys3 utility, i have to setup the virtual button somewhere, right? Where do i do that? Is it in the FSUIPC INI file?

Thanks once again.

Best regards,

Link to comment
Share on other sites

First it asks for which offset.

Then the Operation - it provides the following options -

Decrement value

Increment value

Clear bit

Set bit

Set bit then reset

Set value

Set value then zero

Toggle bit

Ah, you are well set, then. For those 'bit' operations there must be another parameter, to provide either the bit number (eg 0-7) or the equivalent value (1-128). Right? And also you presumably have to tell it the size/length of the offset (1, 2 or 4, or Byte, Word or Dword?).

To press a button or switch on use "set bit", to release it or switch off use "clear bit". That'll provide you with an exact button or switch operation. Start at 3340, with bit 0 (value 1) up to bit 7 (value 128), that's your first 8 switches/buttons, then 3341 -- another 8, and so on. Carry on until you run out of buttons/switches or switch positions (for multiposition ones).

Also - before i setup this offset and operation in the sys3 utility, i have to setup the virtual button somewhere, right? Where do i do that? Is it in the FSUIPC INI file?

No need to "setup" any virtual buttons. Those 288 are always available.

Do the above first. When you've done that, go to FSUIPC's Buttons and Switches tab. When you operate your buttons/switches you will see them identified just like any joystick or GoFlight buttons. Go ahead and assign them to do whatever you like - the OHD macro options or anything else. It's all "normal" FSUIPC button assignment from then on. You don't need to edit the INI file unless you are thinking of doing some clever button programming. Just use the option screen provided for the purpose, it is much easier.

Regards

Pete

Link to comment
Share on other sites

Am trying it right now... will let you know.

Ah, you are well set, then. For those 'bit' operations there must be another parameter, to provide either the bit number (eg 0-7) or the equivalent value (1-128). Right? And also you presumably have to tell it the size/length of the offset (1, 2 or 4, or Byte, Word or Dword?).

Depending on whether i specify one of the options in "Operation" - such as Set Bit or Set Value etc - it provides a field on the screen to accept the bit or value.

Yes it also asks for whether its Byte, Word, LongWord, ShortInt, LongInt or Float64.

Which one should I be using?

I am very grateful for your help.

Best regards,

Link to comment
Share on other sites

Pete:

IT WORKED!!!!

I cant tell you how grateful i am. This has nagged me all week at work, at home and late into the night.

You have made my weekend. I sincerely hope i can return the favor some day.

I tried with a paddle switch. I will try it with a 8 pos rotary selector for the autobrake later tonite.

MANY THANKS.

Best regards,

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.