Limit Switch for ho...
 
Notifications
Clear all

Limit Switch for home position

9 Posts
1 Users
0 Reactions
17.3 K Views
(@asterof)
Posts: 17
Active Member Guest
Topic starter
 

Looked at the samples
Did not see a method to move to home position when indicated by a Limit Switch Input On IO 1

Here is what I have so far

EIGN(W,0,12) 'Assign Word 0 to IO use mask of 12 for 12 IO points
ZS 'Clear Any Status Bits
GOSUB1 'Run C1
END
'==============================================================
C1 'ROUTINE: Home to Index Using Relative Position Mode Motor Address = 1
PRINT("HOME MOTOR",#1)
MP:1 'Set Control to Position Mode
Ai(0):1 'Arm Index Internal Encoder
AT:1=1000 'Set Accel Rate
DT:1=500 'Set Deccel Rate
VT:1=10000 'Set Velocity

G 'Go Start Move
'I think I need to look for the IO point here
PT=I(0) 'Set Target Position to Index location

O=0 'Set Position to Zero
RETURN
'==============================================================

Need a suggestion, thanks

 
Posted : 20/05/2015 6:08 am
(@asterof)
Posts: 17
Active Member Guest
Topic starter
 

so the code got changed to this
Now I am thinking that I need an If statement
so If the home switch is already made it does not need to move
I want to use the #10 drive enable input to start a single shot loop
that checks and if it is not on the home position then a timer runs out and
C1 is called just once

EIGN(W,0,12) 'Assign Word 0 to IO use mask of 12 for 12 IO points
ZS 'Clear Any Status Bits
IF IN(10) == 1 'Is this always true to enable drive ???????
IF IN(1) != 1 'Home Switch
WAIT = 3000
GOSUB C1
END IF
END_IF
END

'==============================================================
C1 'ROUTINE: Home to Index Using Relative Position Mode Motor Address = 1
PRINT("HOME MOTOR",#1)
MV:1 'Set Control to Velocity Mode
AMPS:1=512 'Reduce power
Ai(0):1 'Arm Index Internal Encoder
AT:1=1000 'Set Accel Rate
DT:1=500 'Set Deccel Rate
VT:1=10000 'Set Velocity
G 'Go Start Move
WHILE IN(1) 'Loop, While input 1 is high
O=0 'Set origin
S 'Hard Stop, reason for reduced power setting
AMPS:1=1023 'set power back to max
G 'Go
MP 'Set Control to Position Mode
PT=0 'Set absolute target position
G 'Go Start Move but it already at position, just needed to set move complete
TWAIT 'Wait until move is complete
RETURN
'==============================================================

 
Posted : 21/05/2015 1:00 pm
(@csearcy)
Posts: 0
New Member Guest
 

You may have to switch some logic based on sink/source (ex. 1=OFF or 1=ON)... but here's a hopefully bug free example using Input(0) as the "Run Homing Routine" signal ... and Input(1) as the "Home Switch"...

'Home to Input1 (aka the 2nd pin on most of the motor connectors).
'This example assumes the direction towards the motor is negative... and away from the motor is positive.
'MINV(1) 'un-remark this command if your system runs the other way.
'This program does NOT home automatically when it is powered on. This is intended for bench setup only.
'The call to C1 should be conditional on some other interlock initiated by the machine operator.
ADDR=1 ' Give the motor an address for easy detection with the SMI2 software.

EIGN(W,0) 'Make all I/O Inputs. Note: You can change them to outputs at any time.
'Note: This is where Sink/Source matters. If you're using a D-Type motor... everything on the
'15pin D-Sub is sinking 5VDC TTL Logic... unless you have a CBLIO-ISO1 cable...
'that offers Sink or Source 24VDC I/O using internal isolated electronics.
'If you're using the -AD1 optional expanded I/O on a D-Type motor... all I/O is 24VDC Sourcing...
'The same applies to M-Type motors and all Class6 motors(where all I/O is 24VDC Sourcing).

ZS 'Clear any errors that can be cleared.
'Note: The Drive Enable Hardware input on M-Style motor should be used, but can be disabled(Not recommended).

'Input(0) will be used as a "request to home" signal. This could come from a pushbutton or a PLC output.
'Input(1) will be used as the "actual" home switch.
'Main Program Loop
WHILE 1 'Start of ENDLESS LOOP
IF IN(0)==0 GOSUB(1) ENDIF 'Call the Homing Subroutine if Pin1 is activated (be it sinking or sourcing).
'more code here... should be other IF/ENDIF type commands so this loop runs continuously.
LOOP 'End of ENDLESS LOOP
END

C1 'Home Routine ...if we're on the switch... move off... and back to it... then slow off and stop...
'setting the origin to be 8000 encoder counts away from the switch.
IF IN(1)==0 'Assuming a Normally Open Switch(sinking logic)... We are already on it.
ADT=100 VT=100000 MV G 'Move off of the Switch... which show's we're re-homing.
WHILE IN(1)==0 LOOP WAIT=500 'Wait until we get off of the Switch... then wait for a half second.
X VT=-10000 G 'Decel to a Stop... then Move back to the Switch at a slow speed.
WHILE IN(1)==1 LOOP 'Wait to see the Switch.
ENDIF
IF IN(1)==1 'Assuming sinking logic again... We are not on the Switch.. and we need to find it quickly
ADT=100 VT=-100000 MV G 'Search for the Switch... which show's we're re-homing
WHILE IN(1)==1 LOOP 'Wait to see the Switch.
X VT=100000 MV G 'Move off of the Switch... which show's we're re-homing
WHILE IN(1)==0 LOOP 'Wait to get off the Switch.
X VT=-10000 G 'Decel to a Stop... then Move back to the Switch at a slow speed.
WHILE IN(1)==1 LOOP 'Wait to see the Switch.
ENDIF
S TWAIT WAIT=100 O=-8000 'Immediate Stop... wait to stop... wait 100ms.. and set Origin=-8000.
MP ADT=1000 VT=200000 PT=0 G 'Switch to Mode Positon and Move to Absolute Position zero
TWAIT 'Wait to stop.
WHILE IN(0)==0 LOOP 'Wait here until the "request to home" signal goes away to insure it only occurs once per request.
RETURN 'Return to the ENDLESS LOOP

 
Posted : 21/05/2015 9:20 pm
(@asterof)
Posts: 17
Active Member Guest
Topic starter
 

wow, thanks, that's more than I expected, appreciate it

 
Posted : 22/05/2015 4:58 am
(@asterof)
Posts: 17
Active Member Guest
Topic starter
 

csearcy, you work for Animatics I see a lot of posts from you

 
Posted : 22/05/2015 1:11 pm
(@csearcy)
Posts: 316
Reputable Member Guest
 

Yes. I try to help when I can. I hope your system is working now. Please let me know if you have other questions or concerns.

-Chuck

 
Posted : 22/05/2015 1:16 pm
(@asterof)
Posts: 17
Active Member Guest
Topic starter
 

I could use someone as a consultant on a personal project
I have a simulator that uses a 2330D Motor with a 5 amp 48 VDC PS and
1 1.2 Amp 24VDC PS and has a indexed belt for positive movement
It is a self teach idea, the only manual I have is the Smartmotor Developers Guide
that works great for the commands, but lacks in specific why you do things
and how to do tings. If you know someone who might be interested let me know
Would only be in the role of "If I want to do this how would I do it
type of scenario a few hours a week and to review code I write."

Thanks

 
Posted : 23/05/2015 8:02 am
(@csearcy)
Posts: 316
Reputable Member Guest
 

Hi... call the toll free number 1-888-356-0357 to discuss your project. Hopefully.. we can resolve your problem with tech support.
-Chuck

 
Posted : 23/05/2015 2:03 pm
(@asterof)
Posts: 17
Active Member Guest
Topic starter
 

Its not really a tech support issue
Thanks anyway

 
Posted : 23/05/2015 3:38 pm
Share: