Danny
05-21-2005, 12:49 AM
I've been searching the forums for a way have a switch or button ONLY trigger a routine once for each press of the button.
I have purchased several BS2's and NX-1000 and printed or purchased most of your manuals, I have found that I learn best by example, but
haven't found any examples of what I am trying to do, and you guys have sooooo much information available I'm getting yelled at by my
wife for reading in bed.
I'm working on an interface to a lighting control system, where motion detectors will trigger a serial string to the lighting controller.
The issue is that the motion detectors will provide a closure for as long as they are triggered, so I will be recieving a contact closure
lasting anywhere from 1 second to minutes, depending on how long someone is in the sensing range of the detectors.
I have the 232 strings set up and tested, but I am getting multiple sends, from one trigger.
I have tried two versions of a program for a BS2, but both behave in the same way, this is a device that I am planning to market if I can get the
multiple signal issue resolved (especially since the super carrier board is so inexpensive now!).
I'm attaching the two programs below, any help would be greatly appreciated!
[code]'{$STAMP BS2}
'{$PBASIC 2.5}
'Program description here
'This program is designed TO interface radio receivers TO
'a Crestron STCOM module
'Declare Variables Here
workvariable VAR Byte
delay VAR Byte
rate VAR Byte
downstate VAR Byte
workvariable = 0
delay = 0
rate = 255
downstate = 1
'Serial info here
TxD CON 16
baud CON 16468
pace CON 10
'Main program here
Reloop: BUTTON 0,downstate,delay,rate,workvariable,1,Next1
DEBUG "button 1",CR
SEROUT TxD, baud, pace,["1", CR]
Next1: BUTTON 1,downstate,delay,rate,workvariable,1,Next2
DEBUG "button 2",CR
SEROUT TxD, baud, pace, ["2", CR]
Next2: BUTTON 2,downstate,delay,rate,workvariable,1,Next3
DEBUG "button 3",CR
SEROUT TxD, baud, pace, ["3", CR]
Next3: BUTTON 3,downstate,delay,rate,workvariable,1,Next4
DEBUG "button 4",CR
SEROUT TxD, baud, pace, ["4", CR]
Next4: BUTTON 4,downstate,delay,rate,workvariable,1,RePoll
DEBUG "button 5",CR
SEROUT TxD, baud, pace, ["5", CR]
RePoll: PAUSE 100
GOTO Reloop
Second version
' {$STAMP BS2}
' {$PBASIC 2.5}
'Program description here
'This program is designed TO interface radio receivers TO
'a Crestron STCOM module
'Declare Variables Here
'Serial info here
TxD CON 16
baud CON 16468
pace CON 10
'Main program here
MainLoop: IF IN0=1 THEN Next1
DEBUG "button 1",CR
SEROUT TxD, baud, pace,["1", CR]
GOTO Next1
Next1: IF IN1=1 THEN Next2
DEBUG "button 2",CR
SEROUT TxD, baud, pace, ["2", CR]
GOTO Next2
Next2: IF IN2=1 THEN Next3
DEBUG "button 3",CR
SEROUT TxD, baud, pace, ["3", CR]
GOTO Next3
Next3: IF IN3=1 THEN Next4
DEBUG "button 4",CR
SEROUT TxD, baud, pace, ["4", CR]
GOTO Next4
Next4: IF IN4=1 THEN Repoll
DEBUG "button 5",CR
SEROUT TxD, baud, pace, ["5", CR]
GOTO Repoll
Repoll: PAUSE 100
GOTO MainLoop
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Never create anything you can't control"
"The amount of intelligence on the planet is fixed... the population is growing"
I have purchased several BS2's and NX-1000 and printed or purchased most of your manuals, I have found that I learn best by example, but
haven't found any examples of what I am trying to do, and you guys have sooooo much information available I'm getting yelled at by my
wife for reading in bed.
I'm working on an interface to a lighting control system, where motion detectors will trigger a serial string to the lighting controller.
The issue is that the motion detectors will provide a closure for as long as they are triggered, so I will be recieving a contact closure
lasting anywhere from 1 second to minutes, depending on how long someone is in the sensing range of the detectors.
I have the 232 strings set up and tested, but I am getting multiple sends, from one trigger.
I have tried two versions of a program for a BS2, but both behave in the same way, this is a device that I am planning to market if I can get the
multiple signal issue resolved (especially since the super carrier board is so inexpensive now!).
I'm attaching the two programs below, any help would be greatly appreciated!
[code]'{$STAMP BS2}
'{$PBASIC 2.5}
'Program description here
'This program is designed TO interface radio receivers TO
'a Crestron STCOM module
'Declare Variables Here
workvariable VAR Byte
delay VAR Byte
rate VAR Byte
downstate VAR Byte
workvariable = 0
delay = 0
rate = 255
downstate = 1
'Serial info here
TxD CON 16
baud CON 16468
pace CON 10
'Main program here
Reloop: BUTTON 0,downstate,delay,rate,workvariable,1,Next1
DEBUG "button 1",CR
SEROUT TxD, baud, pace,["1", CR]
Next1: BUTTON 1,downstate,delay,rate,workvariable,1,Next2
DEBUG "button 2",CR
SEROUT TxD, baud, pace, ["2", CR]
Next2: BUTTON 2,downstate,delay,rate,workvariable,1,Next3
DEBUG "button 3",CR
SEROUT TxD, baud, pace, ["3", CR]
Next3: BUTTON 3,downstate,delay,rate,workvariable,1,Next4
DEBUG "button 4",CR
SEROUT TxD, baud, pace, ["4", CR]
Next4: BUTTON 4,downstate,delay,rate,workvariable,1,RePoll
DEBUG "button 5",CR
SEROUT TxD, baud, pace, ["5", CR]
RePoll: PAUSE 100
GOTO Reloop
Second version
' {$STAMP BS2}
' {$PBASIC 2.5}
'Program description here
'This program is designed TO interface radio receivers TO
'a Crestron STCOM module
'Declare Variables Here
'Serial info here
TxD CON 16
baud CON 16468
pace CON 10
'Main program here
MainLoop: IF IN0=1 THEN Next1
DEBUG "button 1",CR
SEROUT TxD, baud, pace,["1", CR]
GOTO Next1
Next1: IF IN1=1 THEN Next2
DEBUG "button 2",CR
SEROUT TxD, baud, pace, ["2", CR]
GOTO Next2
Next2: IF IN2=1 THEN Next3
DEBUG "button 3",CR
SEROUT TxD, baud, pace, ["3", CR]
GOTO Next3
Next3: IF IN3=1 THEN Next4
DEBUG "button 4",CR
SEROUT TxD, baud, pace, ["4", CR]
GOTO Next4
Next4: IF IN4=1 THEN Repoll
DEBUG "button 5",CR
SEROUT TxD, baud, pace, ["5", CR]
GOTO Repoll
Repoll: PAUSE 100
GOTO MainLoop
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Never create anything you can't control"
"The amount of intelligence on the planet is fixed... the population is growing"