Can I program Apex Neptune to handle a 6bit input?

Bramzor

Active Member
View Badges
Joined
Oct 9, 2019
Messages
291
Reaction score
112
Rating - 0%
0   0   0
I was wondering if the following idea would work. Can I create 32 virtual outlets that can handle a 6bit input signal like it would be 32 inputs?

Example:

[ virtual outlet I1 ] OFF: 000000 ON: 000001

Set Off
If SWX1_1 closed Than on
If SWX1_2 closed Than off
If SWX1_3 closed Than off
If SWX1_4 closed Than off
If SWX1_5 closed Than off
If SWX1_6 closed Than off

[ virtual outlet I2 ] OFF: 000011 ON: 000100

Set Off
If SWX1_1 open Than on
If SWX1_2 open Than on
If SWX1_3 open Than off
If SWX1_1 closed Than off
If SWX1_2 closed Than off
If SWX1_4 closed Than off
If SWX1_5 closed Than off
If SWX1_6 closed Than off

[ virtual outlet I3 ] OFF: 000101 ON: 000111

Set Off
If SWX1_2 closed Than on
If SWX1_3 closed Than on
If SWX1_1 closed Than off
If SWX1_2 open Than off
If SWX1_3 open Than off
If SWX1_4 closed Than off
If SWX1_5 closed Than off
If SWX1_6 closed Than off

...
 
Last edited:

SuncrestReef

That Apex guy
View Badges
Joined
Jan 18, 2018
Messages
4,214
Reaction score
9,225
Location
Oregon
Rating - 0%
0   0   0
I was wondering if the following idea would work. Can I create 32 virtual outlets that can handle a 6bit input signal like it would be 32 inputs?

Example:

[ virtual outlet I1 ] OFF: 000000 ON: 100000

Set Off
If SWX1_1 closed Than on
If SWX1_2 closed Than off
If SWX1_3 closed Than off
If SWX1_4 closed Than off
If SWX1_5 closed Than off
If SWX1_6 closed Than off

[ virtual outlet I2 ] OFF: 110000 ON: 001000

Set Off
If SWX1_1 open Than on
If SWX1_2 open Than on
If SWX1_3 open Than off
If SWX1_1 closed Than off
If SWX1_2 closed Than off
If SWX1_4 closed Than off
If SWX1_5 closed Than off
If SWX1_6 closed Than off

[ virtual outlet I3 ] OFF: 101000 ON: 011000

Set Off
If SWX1_2 closed Than on
If SWX1_3 closed Than on
If SWX1_1 closed Than off
If SWX1_2 open Than off
If SWX1_3 open Than off
If SWX1_4 closed Than off
If SWX1_5 closed Than off
If SWX1_6 closed Than off

...

The problem with this approach is that the Apex simply reads each line of the program from top to bottom, and the last line that evaluates True will set the virtual output state. So for example, if your virtual output 13 has any of these switch combinations, it will always report OFF:

100001, 100011, 100101, 100111, 101001, 101011, 101101, 101111, 110001, 110011, 110101, 110111, 111001, 111011, 111101, 111111

Any time SWX1_6 is "1" (CLOSED) this code will always turn the output OFF because that's the last line evaluated:

Set Off
If SWX1_2 closed Then on
If SWX1_3 closed Then on
If SWX1_1 closed Then off
If SWX1_2 open Then off
If SWX1_3 open Then off
If SWX1_4 closed Then off
If SWX1_5 closed Then off
If SWX1_6 closed Then off
 
OP
OP
B

Bramzor

Active Member
View Badges
Joined
Oct 9, 2019
Messages
291
Reaction score
112
Rating - 0%
0   0   0
The problem with this approach is that the Apex simply reads each line of the program from top to bottom, and the last line that evaluates True will set the virtual output state. So for example, if your virtual output 13 has any of these switch combinations, it will always report OFF:

100001, 100011, 100101, 100111, 101001, 101011, 101101, 101111, 110001, 110011, 110101, 110111, 111001, 111011, 111101, 111111

Any time SWX1_6 is "1" (CLOSED) this code will always turn the output OFF because that's the last line evaluated:

Set Off
If SWX1_2 closed Then on
If SWX1_3 closed Then on
If SWX1_1 closed Then off
If SWX1_2 open Then off
If SWX1_3 open Then off
If SWX1_4 closed Then off
If SWX1_5 closed Then off
If SWX1_6 closed Then off

I think thats exactly what I want though. As SWX1_6 will only be used for the outputs > 32. So if SWX1_6 it means in 6 bits that all outputs lower than 31 should be off.

** EDIT: Ow I see I mixed up my bits. So fixed it in the starting post. My reply is still valid though.
 

SuncrestReef

That Apex guy
View Badges
Joined
Jan 18, 2018
Messages
4,214
Reaction score
9,225
Location
Oregon
Rating - 0%
0   0   0
I think thats exactly what I want though. As SWX1_6 will only be used for the outputs > 32. So if SWX1_6 it means in 6 bits that all outputs lower than 31 should be off.

** EDIT: Ow I see I mixed up my bits. So fixed it in the starting post. My reply is still valid though.

Maybe I'm misunderstanding what you're trying to do. In your examples, are the switch numbers ascending left to right, or right to left?

1 2 3 4 5 6
or
6 5 4 3 2 1 ???
 
OP
OP
B

Bramzor

Active Member
View Badges
Joined
Oct 9, 2019
Messages
291
Reaction score
112
Rating - 0%
0   0   0
Example for I32 for example:
BTW I just figured out I could actually do 64 inputs instead of 32, which doubles the possible inputs.

[ virtual outlet I32 ] OFF: 100000 ON: 100001

Set Off
If SWX1_1 closed Than on
If SWX1_6 closed Than on <- I could leave this one out and only have 1 on because
If SWX1_1 open Than off
If SWX1_6 open Than off <- ... it sets it off here
If SWX1_2 closed Than off
If SWX1_3 closed Than off
If SWX1_4 closed Than off
If SWX1_5 closed Than off
 
OP
OP
B

Bramzor

Active Member
View Badges
Joined
Oct 9, 2019
Messages
291
Reaction score
112
Rating - 0%
0   0   0
This conversation makes me feeling overwhelmingly dumb - lol.
I feel the pain with you. Thought I could do 32 inputs on 6 bit (which has 64 possible values, so 32 ON and 32 OFF) but it seems that because I always set Off by default, I could use all values for ON. So have 64 real inputs just on those 6bit (6 wires).

The clue of all of this is that I want to use it for a 64 ports Apex Breakout box. 64 usable ports instead of the 6 that you get on a normal breakout box. And I want it to be able to support the sensors for FMM too on that Breakout box. (So far it seems that it would work in theory)
 

Just grow it: Have you ever added CO2 to your reef tank?

  • I currently use a CO2 with my reef tank.

    Votes: 1 3.1%
  • I don’t currently use CO2 with my reef tank, but I have in the past.

    Votes: 0 0.0%
  • I have never used CO2 with my reef tank, but I plan to in the future.

    Votes: 1 3.1%
  • I have never used CO2 with my reef tank and have no plans to in the future.

    Votes: 27 84.4%
  • Other.

    Votes: 3 9.4%
Back
Top