Relay control timer
Fklaas
Posts: 15
I need to control some relays with timer A" solinoid runs for 2sec. B" solinoid runs for 1Sec. C" solinoid runs for 2 Sec. Like this
A,on
A,off
B,on---B,off
C,on
c,off
goto main;
would be really coool to add more with fully start and stop points!
Thanks, Frank
A,on
A,off
B,on---B,off
C,on
c,off
goto main;
would be really coool to add more with fully start and stop points!
Thanks, Frank
Comments
A On····················· 'actually HIGH "PIN driving relay"
PAUSE 2000
A off
B On
PAUSE 2000
B off
and so on.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Do you have a Stamp Tester?
http://hometown.aol.com/newzed/index.html
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Do you have a Stamp Tester?
http://hometown.aol.com/newzed/index.html
·
Is your timing diagram static or does the time of activation between different solenoids vary?
Post Edited (Paul Baker) : 2/18/2005 9:26:25 PM GMT
A,on
A,off
B,on---B,off
C,on
c,off
Time
>
then start over
Am using led's until I get program right. I need some kind of timer I think?
TSA_ON = time from start to A on
TAB_ON = time from A on to B on
TBB_OFF = time from B on to B off
TBA_OFF = time from B off to A off
TAC_ON = time from A off to C on
TCC_OFF = time from C on to C off
TCE_OFF = time from C off to end
ILOOP:
PAUSE TSA_ON
A ON
PAUSE TAB_ON
B ON
PAUSE TBB_OFF
B OFF
PAUSE TBA_OFF
A OFF
PAUSE TAC_ON
C ON
PAUSE TCC_OFF
C OFF
PAUSE TCE_OFF
GOTO ILOOP
' {$STAMP BS2p}
' {$PBASIC 2.5}
TSA_ON CON 40 'time from start TO A ON
TAB_ON CON 30 'time from A ON TO B ON
TBB_OFF CON 40 'time from B ON TO B off
TBA_OFF CON 60 'time from B off TO A off
TAC_ON CON 60 'time from A off TO C ON
TCC_OFF CON 80 'time from C ON TO C off
TCE_OFF CON 80 'time from C off TO END
A VAR OUT1
B VAR OUT3
C VAR OUT5
ILOOP:
PAUSE TSA_ON
A = TSA_ON
PAUSE TAB_ON
B = TAB_ON
PAUSE TBB_OFF
B = TBB_OFF
PAUSE TBA_OFF
A = TBA_OFF
PAUSE TAC_ON
C =TAC_ON
PAUSE TCC_OFF
C = TCC_OFF
PAUSE TCE_OFF
GOTO ILOOP
This is what you need to do in detail:
' {$STAMP BS2p}
' {$PBASIC 2.5}
TSA_ON CON 40 'time from start TO A ON
TAB_ON CON 30 'time from A ON TO B ON
TBB_OFF CON 40 'time from B ON TO B off
TBA_OFF CON 60 'time from B off TO A off
TAC_ON CON 60 'time from A off TO C ON
TCC_OFF CON 80 'time from C ON TO C off
TCE_OFF CON 80 'time from C off TO END
OUTPUT 1 : OUTPUT 3 : OUTPUT 5 'Set port 1, 3, 5 to output status
A PIN 1 : B PIN 3 : C PIN 5 'Allocate names to pin ports
ON CON 1 'Define HIGH state as a constant name
OFF CON 0 'Define LOW state as a constant name
ILOOP:
PAUSE TSA_ON
A = ON 'Set pin port 1 HIGH
PAUSE TAB_ON
B = ON 'Set pin port 3 HIGH
PAUSE TBB_OFF
B = OFF 'Set pin port 3 LOW
PAUSE TBA_OFF
A = OFF 'Set pin port 1 LOW
PAUSE TAC_ON
C = ON 'Set pin port 5 HIGH
PAUSE TCC_OFF
C = OFF 'Set pin port 6 LOW
PAUSE TCE_OFF
GO TO ILOOP 'Return to beginning
END
Regards,
Bruce Bates
' {$STAMP BS2p}
' {$PBASIC 2.5}
TSA_ON CON 40 'time from start TO A ON
TAB_ON CON 30 'time from A ON TO B ON
TBB_OFF CON 40 'time from B ON TO B off
TBA_OFF CON 60 'time from B off TO A off
TAC_ON CON 60 'time from A off TO C ON
TCC_OFF CON 80 'time from C ON TO C off
TCE_OFF CON 80 'time from C off TO END
OUTPUT 1 : OUTPUT 3 : OUTPUT 5 'Set port 1, 3, 5 to output status
A PIN 1 : B PIN 3 : C PIN 5 'Allocate names to pin ports
******ON CON 1 'Define HIGH state as a constant name
OFF CON 0 'Define LOW state as a constant name
ILOOP:
PAUSE TSA_ON
A = ON 'Set pin port 1 HIGH
PAUSE TAB_ON
B = ON 'Set pin port 3 HIGH
PAUSE TBB_OFF
B = OFF 'Set pin port 3 LOW
PAUSE TBA_OFF
A = OFF 'Set pin port 1 LOW
PAUSE TAC_ON
C = ON 'Set pin port 5 HIGH
PAUSE TCC_OFF
C = OFF 'Set pin port 6 LOW
PAUSE TCE_OFF
GO TO ILOOP 'Return to beginning
END
Did you put in the underscores in the codefragment below ??
TAC_ON CON 60 'time from A off TO C ON
TCC_OFF CON 80 'time from C ON TO C off
If you did not you will get the reported error .
Klaus
' {$STAMP BS2p}
' {$PBASIC 2.5}
' {$PORT COM3}
TSA_ON CON 200 'time from start TO A ON
TAB_ON CON 300 'time from A ON TO B ON
TBB_OFF CON 400 'time from B ON TO B off
TBA_OFF CON 600 'time from B off TO A off
TAC_ON CON 600 'time from A off TO C ON
TCC_OFF CON 800 'time from C ON TO C off
TCE_OFF CON 900 'time from C off TO END
DIR1 = %0 'fk make LED pin an output
DIR3 = %0 'fk make LED pin an output
DIR5 = %0 'fk make LED pin an output
OUTPUT 1 : OUTPUT 3 : OUTPUT 5 'Set port 1, 3, 5 to output status
A PIN 1 : B PIN 3 : C PIN 5 'Allocate names to pin ports
'ON CON 1 'Define HIGH state as a constant name
'OFF CON 0 'Define LOW state as a constant name
ILOOP:
PAUSE TSA_ON
A = 1 'Set pin port 1 HIGH
PAUSE TAB_ON
B = 1 'Set pin port 3 HIGH
PAUSE TBB_OFF
B = 0 'Set pin port 3 LOW
PAUSE TBA_OFF
A = 0 'Set pin port 1 LOW
PAUSE TAC_ON
C = 1 'Set pin port 5 HIGH
PAUSE TCC_OFF
C = 0 'Set pin port 6 LOW
PAUSE TCE_OFF
GOTO ILOOP 'Return to beginning
END