Invoke safety stop from code (HDC2450S)

9 years 7 months ago #29528437 by mjdesrosiers
Hello,
I've got the basics of my script working the way I want, but I can't figure out a way to make the script invoke a safety stop. I'm attempting to augment my mechanical braking with the dynamic braking in the Roboteqs. I can see that safety stops can be triggered by digital inputs, but I can't see how to make my MicroBasic code invoke this. Is it possible?

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

9 years 7 months ago #29528438 by Griffin Baker
Replied by Griffin Baker on topic Invoke safety stop from code (HDC2450S)
If you set up one of your digital inputs for a safety stop and save to controller, then go to console tab. In the in data box field, it will show you what command was issued.

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

9 years 7 months ago #29528439 by mjdesrosiers
I tried what you've suggested. I've reconfigured DIn1 to activate safety stop when it sees HIGH. I can see in the 'run' tab that the digital input is toggling. But I don't see anything show up on the console page. Is there some argument I can give to the SetCommand command in MicroBasic to invoke that safety stop?

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

9 years 7 months ago #29528440 by Griffin Baker
Replied by Griffin Baker on topic Invoke safety stop from code (HDC2450S)
It doesn't show up in the console tab. If you want to see a written version of that in the console tab, you'd have to use a print statement that shows when that goes active.

example

dim sf as integer ' sf = safety stop
top: 'label header
sf = getvalue(_DI, 1) ' queries digital input 1
if sf = 1 then 'begins comparison check against digital input status
Print("Safety stop enabled \r")
else
print("Safety stop not enable \r")
end if
wait(10) ' wait 10 mS
goto top ' Loop sequence top label header

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

9 years 7 months ago #29528442 by mjdesrosiers
Ok, so that would check whether safety stop would be enabled. I don't want to check -- I want to enable it. I want to be able to turn it on and off by code. Is this possible?

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

9 years 7 months ago - 9 years 7 months ago #29528444 by Griffin Baker
Replied by Griffin Baker on topic Invoke safety stop from code (HDC2450S)
Setconfig(_dina, 1, 17) tells digital input to safety stop.
setconfig(_dina, 1, 0) tells digital input safety stop to be off.

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

9 years 7 months ago #29528447 by mjdesrosiers
Ok, I get how you're saying to do this. Instead of directly turning on the safety stop, I change the action that the pin wants to take. That makes some sense, and sounds like it might work. I'm not sure about the changing of the configuration, though. Your code suggests that I would want to use setconfig(_DINA, 1, 17) to change channel one. But from what the manual looks like (excepted below), I would want to use 33 (1 + 32, for motor 1). Can you advise which would be correct for a one-motor configured HDC2540S?

Digital Input Action
This parameter sets the action that is triggered when a given input pin is activated. The
action list includes: limit switch for a selectable motor and direction, use as a deadman
switch, emergency stop, safety stop or invert direction. Embedded in the parameter is the
motor channel(s) to which the action should apply.
Syntax: ^DINA cc (aa + [mm])
~DINA [cc]
Where: cc = Input channel number
aa = 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
mm = mot1*32 + mot2*64
Default Value: 0 = no action for each input
Example: ^DINA 1 33 = Input 1 as safety stop for Motor 1. I.e. 33 = 1 (safety stop)
+ 32 (Motor1)

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

9 years 7 months ago - 9 years 7 months ago #29528448 by Griffin Baker
Replied by Griffin Baker on topic Invoke safety stop from code (HDC2450S)
Use the one that your controller reports back. So if it reports back 33 then use 33.

Mine had reported back 17 because I forgot to check channel 1 motor.

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

Time to create page: 0.066 seconds