Hi Lou, Yes this works, it sends one email, but that's it it does nothing else.Lou Apo said:I wrote this using bitwise concept. I haven't run it, but I think it should work. Give it a try and let me know.
START
TESTEQ IP2[500] 1
CALLSUB KEYMAIL
TESTEQ IP2 0
CALLSUB SETBIT3
END
KEYMAIL:
ANDB 4 RAM1 (sets the 0 bit to 1 if 3rd bit is 1, otherwise 0)
BNZ ABORT (if 0 bit from above is not zero (it is thus 1), it branches to abort)
EMAIL EM5 (otherwise email gets sent)
ORB 4 RAM1 RAM1 (sets 3rd bit to 1, which blocks future emails)
RET
ABORT:
RET
SETBIT3:
ANDB 4 RAM1 (checks to see if 3rd bit is already 0)
BZ ABORT (if it is 0, it aborts)
XORB 4 RAM1 RAM1 (if it is not zero this flips it to 0 so email can be sent)
RET
By the way, tell me exactly what your code is doing, I am quite certain you could have this program significantly shortened/simplified.
Basically here is what the desired outcome is.
IP1 is hooked up to my door buzzer, and when someone presses the button I just want one email to be sent to me from email1
IP2 is hooked up to the keypad, and when someone enters the correct code, OP1 is triggered for 1 second, that sends a signal to the door strike that opens the door, then sends an email from email5
That's basically it.
START
TSTEQ IP2[500] 1
CALLSUB KEYMAIL
TSTEQ IP2 0
CALLSUB SETBIT3
END
KEYMAIL:
ANDB 4 RAM1
BNZ ABORT
EMAIL EM5
ORB 4 RAM1 RAM1
RET
ABORT:
RET
SETBIT3:
ANDB 4 RAM1
BZ ABORT
XORB 4 RAM1 RAM1
RET
I have other code that you helped me with some time ago, where it controls the heat, and will also like to implement that into a code that works with the keypad and the door buzzer.
Thanks for your continued help.