PDA

View Full Version : SIOC coding help!!!



One_shot
10-19-2015, 07:22 AM
Hey all,
I'm working on the coding for my APU panel which has 5 Korry switches. In SIOC, each LED/Switch works separate. I'm having a problem thinking up how to code it though. Can anyone help? I'm trying, as a test, to set it up so that when button 4 is pressed, no LED will turn on unless Button 3 is pressed, which also will not have an LED light up unless Button 1 is pressed. Button 1's LED will only stay on after Button 2 is pressed after Button 1, and Button 2's LED will only turn on if Button 1 is pressed, and only for 10 seconds.
Does that make any sense?
Here's a picture of the panel I'm working with, to hopefully understand why there's a flow to the LEDs depending on each switch state (on or off, or pressed).
Button 1 - Power
Button 2 - Start
Button 3 - Generator
Button 4 - Bleed Air

The APU start procedure actually goes like this:
POWER button is turned on. The LEDs in all 5 will blink in sequence to run a test. (I'm still trying to figure that out too) After the LED test, no lights will turn on. Pressing START will activate the STARTER LED in the start button for 10 seconds, at which time the LED will go out, the RUN LED in the POWER button and WARN LED in the GEN button will light up. Pressing the GEN button will change from WARN to RUN. Now the BL AIR button will light up when pressed.

I would be happy if someone could help me write this code... at least the beginning part after the LED test. My problem is having 1 LED light up only when 2 buttons are pressed like in the case of the START led after the POWER is turned on...

Regards,
Jack

One_shot
10-24-2015, 12:49 PM
Does anyone know if this is possible, or is it just quiet in these forums?

kiek
10-25-2015, 01:54 AM
It is certainly possible. However, I have no time at the moment to help you out.
Nico

One_shot
10-25-2015, 04:09 AM
It is certainly possible. However, I have no time at the moment to help you out.
Nico

That's sort of the problem I am running into all over. Either nobody has the time to help explain it, or they don't know how to do it. I've been trying to figure out this SIOC annoyance for the last 4 or 5 weeks.

fordgt40
10-25-2015, 07:04 AM
Jack

As you suggest, that the reason you have had little response is to develop sioc coding is quite time consuming. The coding you need as outlined above does not flow off the pen! Also, it rarely works as intended first time and often the original logic is either flawed or does not cover all eventualities. So, the only real answer is to do it yourself. This is not as daunting as you think it might be. We all started somewhere and the secret is to build up your coding in small sections, learning and understanding as to go - there is no quick answer.

So, I suggest that you start with the simple logic steps, getting one or two leds to turn on or off depending on switch combinations. Using the IOCPConsole log function is very useful as you can see what is happening within your code and amend accordingly.

Nico`s site has a wealth of examples you will need such as logic flow and keeping a led lit for 10 seconds etc.
The other bit of missing information which will help is the use of Boolean logic. For example, to turn on a led only when two switches are both set can easily be coded as

C0 = &switch1 = 1 // Co is an internal logic variable that will be set to logic 1 if &switch = 1
C1 =&switch2 = 1 // ditto for &switch 2
IF C0 AND C1 // so only if both switches are set will both C0 and C1 have the value of 1 and then turn on the Led
{
&led1 = 1
}
I have not bothered with variable definitions above, but the code and some reading should help. You can also achieve the same by using lots of IF statements but the logic flow can get difficult to follow.

So, Jack, just dive in and try the coding - you may be surprised :)

David

BuzziBi
10-25-2015, 07:05 AM
Maby some help here: http://www.lekseecon.nl/howto.html#led

One_shot
10-25-2015, 07:48 AM
So, Jack, just dive in and try the coding - you may be surprised :)

David

Thank you David,
that's actually an answer that points me in a better direction. I've seen all of Nico's examples, and while I can do the very basics, this panel has had me stuck. Like, dead in the water with no paddle type of stuck. I'll try and see what I can come up with, again. If the boolean works, great! The problem that I have had lately isn't with the examples, but trying to get them to work together. I can get 1 Korry to light 2 LEDs when needed, but not multiples. I'll post the coding if I have issues... maybe you can check it and help me correct it.

Thanks,
Jack

fordgt40
10-25-2015, 08:17 AM
Jack

If you put the effort in and give it a good try, then I can offer suggestions etc.

David