Re: SIOC Audio Panel Code
Hello Polmer.
You could construct a single IF test:
Code:
.
.
C0 = &SwitchA = 1
C1 = &SwitchB = 1
C0 = C0 AND C1
IF C0 = 1
{
....set bit 5
}
.
.
A nested IF seems less laboured, though:
Code:
.
.
IF &SwitchA = 1
{
IF &SwitchB = 1
{
set bit 5
}
}
.
.
I think you should define your switches as Type I.
Jim
Re: SIOC Audio Panel Code
Yes you are correct,
the switches are type I, not type "P".
I tried both variation of the code but cant get both Com1 & Com2 to be on at the same time. Heres what I am running now with no luck....
HTML Code:
Var 1042, Link FSUIPC_IN, Offset $3122, Length 1 // Radio Audio Bytes
Var 1034, Link FSUIPC_OUT, Offset $3122, Length 1 // Radio Audio Bytes
Var 1035, Link IOCARD_SW, Input 111, Type I // COM1 Audio
{
V1034 = CHANGEBIT 7 ,V1035 // COM1 vs COM2
}
Var 1036, Link IOCARD_SW, Input 109, Type I // COM2 Audio
{
V1034 = CHANGEBIT 6 ,V1036
}
Var 1038, Link IOCARD_SW, Input 108, Type I // NAV1 Audio
{
V1034 = CHANGEBIT 4 ,V1038
}
Var 1039, Link IOCARD_SW, Input 115, Type I // NAV2 Audio
{
V1034 = CHANGEBIT 3 ,V1039
}
Var 1040, Link IOCARD_SW, Input 116, Type I // MKR Audio
{
V1034 = CHANGEBIT 2 ,V1040
}
Var 1041, Link IOCARD_SW, Input 110, Type I // ADF Audio
{
V1034 = CHANGEBIT 0 ,V1041
}
Var 1043, Link IOCARD_SW, Input 108, Type I
{
&FO_JoyStick64 = CHANGEBIT 3 ,V1043 // toggle bit 0 of joystick 64
}
Var 1044, name FO_JoyStick64, Link FSUIPC_OUT, Offset $3340, Length 4
Var 1046
{
IF V1035 = 1
{
IF V1036 = 1
{
V1047 = 1
}
}
}
Var 1047
{
V1034 = CLEARBIT 7
V1034 = CLEARBIT 6
V1034 = CHANGEBIT 5 ,V1047
}
Re: SIOC Audio Panel Code
Hello Polmer,
The script attached to V1046 is never executed as the variable is never changed. Consequently, V1047 never changes.
You can set the "receive both" flag without using an explicit "IF"
Code:
Var 1034, Link FSUIPC_OUT, Offset $3122, Length 1 // Radio Audio Bits
Var 1035, Link IOCARD_SW, Input 111, Type I // COM1 Audio
{
V1034 = CHANGEBIT 7 ,V1035 // COM1 vs COM2
CALL V1046
}
Var 1036, Link IOCARD_SW, Input 109, Type I // COM2 Audio
{
V1034 = CHANGEBIT 6 ,V1036
CALL V1046
}
Var 1046 Link SUBRUTINE
{
//* Set "receive both" if both switches pressed
//* Else, clear the flag
L0 = V1035 AND V1036 // L0 = 1 iff COM1 and COM2 are both on
V1034 = CHANGEBIT 5, L0
}
What do you want to happen to the transmit flags (bits 6 and 7) when both buttons are pressed? Switching them both off doesn't seem correct.
Jim
Re: SIOC Audio Panel Code
Jim,
It works like a charm with your code!
Thanks for the help with this.....much apreciated.
~Polmer