Use of _DOL or _DOA command to trigger external event

8 years 4 months ago - 8 years 4 months ago #29530572 by hbtri7
Hi,
I've written a script that will adjust the motor speed based on some external conditions and now I'd like the controller to apply an external condition based on a value in the script. I would like to have the controller send a signal which completes an external circuit. I think this entails using the _DOL or _DOA command and perhaps using that voltage to activate a relay switch. Could you write a simple example of the proper use of the _DOL command? I have read the micro basic reference and although it shows the command their is no example usage.
Thank you.

Please Log in or Create an account to join the conversation.

8 years 4 months ago #29530573 by TechSupport
We have sample scripts available, but just not for the one you are trying to write. Without specifics, we are in the dark.

The easiest form of logic arguments to use to trigger actions like you want are to use "if then statements".

If something happens, then take action.


dim d1 as integer ' declare variable d1

Top: 'loop header
d1 = getvalue(_DI, 1) 'queries digital input 1

If d1 = 1 then 'looks to see if digital input 1 is high
setconfig(_DINL, 1,1) ' sets digital input level to one setting
else ' else condition
setconfig(_DINL, 1, 0) ' sets digital input level to the other setting
end if ' required to close the if then argument.

This is untested script example.

dev.roboteq.com/dev1/index.php/support/downloads

Please Log in or Create an account to join the conversation.

8 years 4 months ago #29530574 by hbtri7
Ok that makes sense. So in the case of an output the command would be similar setconfig(_DOL, 1, 1) and the only option for the second number is a 1 or zero, high or low? Do you know what voltage the output signal is? I would think I could use the high output signal to actuate a relay.
Thank you

Please Log in or Create an account to join the conversation.

8 years 4 months ago #29530575 by TechSupport
For reference, make a setting change, and then save to controller. Then go to the "Console" tab to see what the utility issued to make the command change.

If you are activating a 5V relay, you can do so from the digital outputs, since the digital inputs are "inputs". 5V would go to once coil of relay, and the other coil goes to digital output. Digital outputs are a switching ground. So if an external power source is used, you must share that power source ground with the I/O ground on either pin 5 or 13.

You can toggle on and off the output via the following commands.

setcommand(_Dset, 1) ' digital output 1 on

setcommand(_Dres, 1) ' digital output off
The following user(s) said Thank You: hbtri7

Please Log in or Create an account to join the conversation.

Time to create page: 0.067 seconds