PLC code to toggle TTL daily

The timing was based Dr. Lu's post. I don't remember exactly how long would take the rotary phone to finish dialing zero.  I think it is probably like 3 seconds, if that is the case, I would divide 3 seconds by 10, and each position will have 300mS, Then I will change the timing to:
 
dial_ph:
tsteq VAR1 0
set VAR1 10
set RAM1 0
dialing:
set op1 1
delay 100
set op1 0
delay 200
inc RAM1
tsteq RAM1 VAR1
RET
goto dialing
 
between each digit of the phone number, leave at least one second or two seconds.
 
Not that it's not interesting, but why have we gone so far off topic???
 
I do love these little boards, so fun.
 
can't wait to get my sprinkler system automated using the webcontrol, with (hopefully) some adidtions like soil moisture and other plus ups (maybe even weather forecast data) influencing the watering schedule.
 
This will dial a 7 digit phone number that you put into urom1.  Unfortunately, you can't include the area code becuase it is more than a 32 bit signed integer.  So if you need area code, you'll need to divide it out into a separate subroutine.  i used 500ms between numbers and 200ms between pulses.  You might need longer than 500 between numbers, but it seems like the old pulse phones were about that.

 

START    
    TSTEQ WHATEVER YOU WANT TO TRIGGER THE DIAL  
    CALLSUB DIAL 
    WHATEVER OTHER CODE YOU WANT
    END    


DIAL:
    SET RAM2 10000000
SET OP1 1 (lift the receiver)
LOOP1:
    DELAY 500   (puts a 500ms delay between digits)
    MOD UROM1 RAM2 RAM3  (remainder function, newer firmware only, this clips off digits to the left)
    DIV RAM2 10 RAM2  (decreases ram2 by factor of 10 so you can clip the digits to the right)
    DIV RAM3 RAM2 RAM3 (clips off the digits to the right)
LOOP2:
    SET OP1[200] 0  (pulses the number by "hanging up" for 200ms x times for each digit of the number)
    DELAY 400   (puts a 200ms pause after the above 200ms pulse)
    DEC RAM3    (counts down the number of pulses for each digit)
    TSTNE RAM3 0  (gets you out of the repeat when the digit is done)
    GOTO LOOP2   (repeats the pulse if you aren't done with the digit)
    TSTNE RAM2 1  (gets you out of dialing when you have done the last digit)
    GOTO LOOP1 (returns you to calculate the next digit if your aren't done)
WHATEVER STUFF YOU WANT TO HAVE HAPPEN AFTER THE DIAL
SET OP1 0 (HANG UP)  
    RET    
 
 
 
Back
Top