Amps Trigger

6 years 3 weeks ago - 6 years 3 weeks ago #29532721 by tec,jesusdiaz
Amps Trigger was created by tec,jesusdiaz
Hi everyone
I have a question, can the amps trigger return a boolean value? That is, it can return a value true if the trigger trigger is activated? Or false if not activated

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

6 years 3 weeks ago #29532722 by blake
Replied by blake on topic Amps Trigger
This is possible via MicroBasic script

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

6 years 2 weeks ago #29532724 by tec,jesusdiaz
Replied by tec,jesusdiaz on topic Amps Trigger
I understand that it is possible with Microbasic, but how? I have only seen that the activation of the amps trigger can take some of these actions:
0: No action
1:Safety stop
2: Emergency stop
3: Motor stop
4: Forward limit switch
5: Reverse limit switch
6: Invert direction
7: Run MicroBasic script
8: Load counter with home value
But I need to use it as a bool variable, false if not activated, true if activated

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

6 years 2 weeks ago #29532726 by blake
Replied by blake on topic Amps Trigger
You would simply monitor the motor current and if the current reaches above a chosen limit then you would set a variable to true. See a sample below:
' This script is provided "as-is", without warranty of any kind,
' expressed or implied, including but not limited to the warranties of
' merchatability, fitness for a particular purpose and
' noninfringemement. In no event shall Roboteq be liable for any claim,
' damages or other liability, arising from the use of the software"

' Reads the controllers motor current and then sets the level of a boolean variable based on the level


option explicit 'Force variable declaration

'Variable declarations
dim AmpsLimit as integer
dim Motor1_Amps as integer
dim AmpsTrigger as boolean

AmpsLimit = 500 'Sets the amps trigger level to 50A, change as needed (Amps * 10)



'main loop
Top:

Motor1_Amps = getvalue(_A, 1) 'Query the current seen on motor channel 1 (pg 230 of manual)

if Motor1_Amps >= AmpsLimit then  'See IF functions described on pg 193 of manual
	
	AmpsTrigger = True
	
else
	
	AmpsTrigger = False
	
end if

wait(10) 'loop every 10 milliseconds, 100Hz)

goto Top 'go to top of loop

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

5 years 10 months ago #29532888 by Dale@handle-tech.com
Replied by Dale@handle-tech.com on topic Amps Trigger
Because getvalue(_A , 1) returns an integer a simple line like getvalue(_A, 1) >= 500 should return the Boolean your looking for.
This should work in any place you want a logical true or false

Also uses less lines of code and fewer declared variables. With memory at a low limit

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

Time to create page: 0.074 seconds