Board issues

Sorry, no offence intended. If I get a minute this afternoon I'll sketch something for you that should work.
I too am a network admin (Unix servers plus all the routers etc) - but have been in electronics R&D and manufacturing for 35 years, so perhaps my perspective is different...

No offense taken. Thanks for your help.
 
With this one regulator, you can power 3 CO sensors at the same time, then measure then readings one after another in the later part of the 1.5V period. Each WebControl board can monitor 3 places carbon monoxide sensors, providing networked carbon monoxide monitoring capability.
 
With this one regulator, you can power 3 CO sensors at the same time, then measure then readings one after another in the later part of the 1.5V period. Each WebControl board can monitor 3 places carbon monoxide sensors, providing networked carbon monoxide monitoring capability.

Thanks for the idea. When I get another board that has some rams and vars free, I'll give it a try.
 
If you have 3.02.15 and later firmware board, you can use ANDB, ORB, and XORB to save a lot memory. With those bitwise operator, you can store up to 31 binary states in one VAR or RAM.
 
If you have 3.02.15 and later firmware board, you can use ANDB, ORB, and XORB to save a lot memory. With those bitwise operator, you can store up to 31 binary states in one VAR or RAM.

I have version 3.02.11. Is there a way to update my board to the latest version? Good to know that the latest version fixed the issue of running out of variables.
 
If you have 3.02.15 and later firmware board, you can use ANDB, ORB, and XORB to save a lot memory. With those bitwise operator, you can store up to 31 binary states in one VAR or RAM.

Can you give an example using the bitwise operator to store more than two states in one VAR or RAM? When I do get another board, I would like to have the code worked out.

Thanks
 
Say you have VAR7 for the status tracking, (you can use RAM, too), and you define which bit is for which purpose: I suppose you start from number1 instead of 0 for example,
bit1 email1 already send
bit2 email2 already send
bit3 email3 already send
bit4 email4 already send
...
bit9 front door opened
bit10 side door opened
bit11 back door opened
...
bit30 ceiling fan is on

Each bit has a value, when they stored in VAR or RAM. The VAR or RAM value is all those bits added together. Say bit11 is the one you want to track, start your windows computer, in accossories, you go to "view" tab change the calculator to "programmer" mode. Then it will allow you to set in Dec or HEx or Bin mode. Select Bin mode. You noticed the keyboard will only allow input 0 or 1 in this mode. Enter 10000000000, "1" followed by 10 zeros. Then change the display from Bin to Dec, you will see bit 11 is 1024. Please note this is to start counting first flag is 1, not zero. If you start counting from zero, then you will get 2048 instead of 1024. You have to make sure your are consistent.

To set bit 11, you can simple do this:
ORB VAR7 1024 VAR7
This will turn bit 11 in VAR7 to 1, if that was 0 before;

To check bit11 status, you can also do
ANDB VAR7 1024 RAM1
to check zero bit by BZ or BNZ, or check RAM1 value is zero or not.

To unset bit11, you can use
XORB VAR7 1024 VAR7
Please not, if the bit was 1 before, this will set the bit to 0. But if the bit was 0 before, XORB will set that bit to 1.
 
To set bit 11, you can simple do this:
ORB VAR7 1024 VAR7
This will turn bit 11 in VAR7 to 1, if that was 0 before;

Just for clarity, your comment is technically wrong. It READS like it will only turn bit 11 on if it was previously 0.
The ORB will actually set the bit *REGARDLESS* of its previous state. (Yes, if it was 1 it will force it to 1, which is no change, but for people who may not have encountered bitwise logic, your comment is actually misleading and would have been clearer if you'd just said "will turn bit in VAR7 to 1" and left it at that.

To unset bit11, you can use
XORB VAR7 1024 VAR7
Please not, if the bit was 1 before, this will set the bit to 0. But if the bit was 0 before, XORB will set that bit to 1.

The way to definately reset the bit is to ANDB with the inverted mask.
Eg, if you are using only the lower 16 bits of VAR7 as flags, to turn off bit 11 you would
ANDB VAR7 64511 VAR7

(64511 decimal is binary 1111101111111111)

If you are using all 32 bits, the easy way to calculate the mask is to take your required number (1024 in your above example) from 4294967295.

After an ANDB with the inverse mask, the bit will *ALWAYS* be zero, regardless of previous state.
 
I think I understand(not really) how bitwise works. How about we work out an example to make it more clear.

Let say if the temperature gets below 50.0F(T1), it sends EM1. Then if it gets below 40.0F(T1), it sends EM2. How would you write it out if we're working with VAR1?

I think this would be a good starting point for most people, then we can glean the rest so we can adapt it to our situation. My biggest issue is I get my status of my alerts through VAR. So if I have a water sensor that goes off, it sets a var for alarm status and multiple email protection.

I should mention that I use openremote to monitor the board. I get counts for how often my dehumidifier and my sump pump runs. The counts are put into vars, so I can clear them later.
 
To set the flag, you will need also have to think through when you want to clear the flag. To set the flag when TS1 get below 50 is easy, send email2 when TS1 gets below 40 is also easy, but at what condition, you allow next email send through EM1 and EM2?

Basically, you will need to have complete plan when to set the flag, when to unset the flag. For example, once T1 is greater or equal 50, you will clear the EM2 flag, when T1 is greater or equal 60, then you reset EM1 flag.
 
OK. Here is what I came up with.

start
callsub resets
tstle t1 500
goto flag1
tstle t1 400
goto flag2
end

resets:
tstge t1 510
xorb var1 1 var1
tstge t1 410
xorb var1 2 var1
ret

flag1:
andb var1 1 ram1
tsteq 0 ram1
email em1
orb var1 1 var1
ret

flag2:
andb var1 2 ram1
tsteq 0 ram1
email em2
orb var1 2 var1
ret

I'm using var1 bit one and two and putting it into ram1 to test my conditions at least I think so. When it gets below 50F, it sends an em1 and will not send em1 again until the temp gets above 51F. The same with 40F.

SInce I don't have a board to test this, let me know if the code is right. Thanks.
 
Because XORB will toggle the bit, is the bit was zero, it will flip into one, if it was one, it will flip to zero, you resets subroutine might be changed to:

resets:
tstge t1 510
callsub resett1
tstge t1 410
callsub resett2
ret

resett1:
andb var1 1
bnz sett1zero
ret
sett1zero:
XORB var1 1 var1
ret

resett2:
andb var1 2
bnz sett2zero
ret
sett2zero:
XORB var1 2 var1
ret
 
Back
Top