Latching an internal Bit

Team, I hope this is an easy one

I have 2 inputs, and one output

for Argument,

Input A (physical switch) (OFF- (ON)) Switch (Magnetically held)
Input B (internal Driven Bit - input is serial from elsewhere)
Output C (physical output) (Magnet)

When A is High --> Output C is High, this also triggers input B to be sent after X time
When A is High and B is High --> C is also High, BUT

After a period, Input B goes low, and this needs to trigger Output C to go Low (which was triggered originally by Input A which is still high at this stage, sending Output C low will Physically set Input A to LOW also)

(Magnetically held Switch)

In Basic Steps

A Low + B Low = C Low (Normal off state)
A High + B Low = C High (Held) - Holds A High
A High + B High = C High (held) - Hold A high
A High + B Low = C Low (Released)
And
A Low at anytime = C is LOW, regardless of B

A is Held in the ON By C (The Magnet)
A is a Toggle OFF-(ON)

!A = !C
!A & !B = !C
A & !B = C
A & B = C
A & !B = !C (only after the above)

any thoughts Ben

jabmel:
A is Held in the ON By C (The Magnet)
A is a Toggle OFF-(ON)

A & !B = C
A & B = C
A & !B = !C (only after the above)

very confusing - conflicting statements

sees like there is a time element that isn't represented by you logic statements

sounds like maybe A will "arm" a system. B rising makes C HIGH. B going low causes C to go LOW as well as dis-arming the system so that without "reseting(?)" A, B rising has no further effect

Thanks for that. Yes. It’s a bit of a weird one.

It is part of DCS simulator.

The APU (aircraft Auxiliary Power Unit)

The switch that operates it is a 2 position switch.

OFF and Monetary ON. “OFF (ON)”

But. The monetary on is held on by a magnet

So the onboard computer can turn it off as no longer needed.

But the simulator when written failed to provide this output.

So the sequence is.

Switch ON (digital input)
This also triggers the output to hold the magnet
After a time the APU light is lit (internal game bit) this can be used.

Once the APU is no longer required this light goes out and the APU is turned off. I need to send the (Output low) for the magnet but it’s still held high by the same switch.

So the issue is.

The switch can trigger the magnet, but the magnet is needed to turn the same switch off. Once the light turns off.

Or at any time the switch is off. The output is off

Then all Over again if needed.

are you looking at solving for this with logic gates / delay components or with code ?

No time delay.

Logic and code. Please.

sounds like maybe A will "arm" a system. B rising makes C HIGH. B going low causes C to go LOW as well as dis-arming the system so that without "reseting(?)" A, B rising has no further effect

i believe my earlier description is accurate.
don't understand the need for a delay.

believe you need a state variable, "arm", that is set when A is HIGH.
so C is set if (arm & B)
the C falling resets arm

how do you capture the C falling?

I don’t set the time delay. That’s in the game software.

The switch is then held by the magnet to hold the switch in the on position.

I need to somehow release this output to turn the switch off.

When the game turns the light off after X time

But the light does not turn on as soon as the switch is turned on.

And the duration the light stays on is completely variable. Can be 1 min to XX mins

It's just a matter of states as gcjr said. Keep an enum to tell you where you are - a little state machine.

When you flip the switch to APU start, I assume you send that info to DCS. At that time set your state variable to APUStarting and use the magnet to hold the switch.

DCS will tell you to light the APU light. State= APURunning.

DCS tells you to turn the light off. State = APUOff, release the magnet.

I don't get the

I need to send the (Output low) for the magnet but it's still held high by the same switch.

. Do you have control over the magnet?

Once the APU is no longer required this light goes

how do you know it's no longer required? user action? time-out? black-magic?

that's what I understand in terms of state machine, is that correct?

J-M-L:
how do you know it's no longer required? user action? time-out? black-magic?

I think the APU is being used to start the main engines. There's user action required in the simulator to command them to spool up and an amount of time for that to complete.

Once they're running, the APU is not needed. So the Arduino doesn't know when the APU is shutdown without notification from the sim. It could probably estimate it from timing when the second engine was started, but maybe ambient temperatures or other factors make that vary.

The diagram looks perfect.

I can only control the switch. (On or off) but the game
Can turn it off to. Hence the magnet.

The switch needs to be held by the magnet until the APU light is out. (Or turned off physically)

The APU light is controlled by the DCS game. I can’t control this. But it is an output from the game (input to Arduino) I can use.

Yes correct. The APU starts the main engines. When they run and are stable the game (and in the real aircraft) turns the APU off. But the writer is the game interface forgot this. So I need to emulate it. It can’t be a timer.

Yeh only bits i have are.

Import Switch on off. (Real life)
APU run light on and off. Internal game bit)

Output the magnet on and off (output I drive)

Does DCS spam you with the state of the APU light or does it just let you know when it changes?

can you fill the blanks in the scenarios:

press the switch ON
monitor APU light, when it goes out, DO WHAT ?

press the switch ON
press the switch OFF, DO WHAT ?

wildbill:
Does DCS spam you with the state of the APU light or does it just let you know when it changes?

wildbill:
Does DCS spam you with the state of the APU light or does it just let you know when it changes?

it gives an output to drive a physical LED, the Physical LED matches the Game indication

J-M-L:
can you fill the blanks in the scenarios:

press the switch ON
monitor APU light, when it goes out, DO WHAT ?

press the switch ON
press the switch OFF, DO WHAT ?

J-M-L:
can you fill the blanks in the scenarios:

press the switch ON
monitor APU light, when it goes out, DO WHAT ?

press the switch ON
press the switch OFF, DO WHAT ?

press the switch ON ( MAG OUTPUT HIGH)
monitor APU light, when it goes out, DO WHAT ? (MAG OUTPUT LOW)

press the switch ON ( MAG OUTPUT HIGH)
press the switch OFF, DO WHAT ? (MAG OUTPUT LOW)

But remember the MAGNET (or output drving the magnet) is holding the switch physically in the ON position, thus the Switch input High, I need to logically break (manipulate) this output when the APU light turns off, whilst the switch is still on to allow it to turn off by releasing the magnet holding the toggle switch it is a spring toggle back to off

so you need some sort of actuator pressing the button physically for you? how do you plan to release the MAGNET?

Can we somehow just record the “on”input as a momentary bit. And use it to toggle an internal bit.

Then it won’t care that it stays on. Until it’s turned off ie the change of state.

J-M-L:
so you need some sort of actuator pressing the button physically for you? how do you plan to release the MAGNET?

The magnet releases when the switch is turned off, this in turn drives the output low until next turn on.
But the hard bit is I need to break this output logically when the APU light (game input) turns off. But I can’t break it as the switch is also holding it on. I need to let if forget the switch is on. Can the first turn in monetary drive an internal toggle but somehow

The switch is turned off 2 ways.

Either physically moving the real switch. Or the aircraft telling it it’s no longer needed.

This can only be done at this stage by trying to use the APU light turning off.

It might be useful to see some code. Do you tell DCS that the switch is pressed when it BECOMES pressed or repeatedly that it IS pressed.

Similarly, does DCS keep telling you the state of the APU light whether it’s changed or not? I suspect it does.