Control via I/O in ...
 
Notifications
Clear all

Control via I/O in competition with the Host

7 Posts
1 Users
0 Reactions
22.9 K Views
(@mikasv)
Posts: 4
New Member Guest
Topic starter
 

Hello,

I would like to implement a setup where I have a computer program controlling the SmartMotor (the main loop is monitoring the motor position constantly, and the events perform simple motions up and down), but, at the same time, it reacts to the hardware buttons (Digital I/O pin transitions) for jogging up and down.

What is the correct way to program such 'Hardware interrupts', if any?

Mikas

 
Posted : 30/01/2013 9:41 pm
(@csearcy)
Posts: 0
New Member Guest
 

Hi Mikas,
Is it a Class5 SmartMotor (firmware version 5.00 or higher)?
What is the part number?

 
Posted : 30/01/2013 9:44 pm
(@mikasv)
Posts: 4
New Member Guest
Topic starter
 

Motor details (sorry for not adding before):

FW: 478T
Model: SV1720-PLS
Serial#: G18144

 
Posted : 30/01/2013 11:41 pm
(@csearcy)
Posts: 0
New Member Guest
 

With Ver4.78... You have two interrupts available... that automatically do a GOSUB1 or GOSUB2... (Labels C1 and C2)...
F=32 'enable call to C1 on a new occurance of both fault and motor on.
F=64 'enable call to C2 on a user pin G high to low edge transition(shorting pin7 to pin13 on the 15pin DSub connector).
Note: For both interrupts to be enabled... F=96

You could use pin7(PortG) to trigger the interrupt to jog... but you can also do that in a WHILE LOOP in your SmartMotor program.
Ex...
WHILE 1
IF UAI==0 GOSUB10 ENDIF 'pin1 is grounded to pin13
IF UBI==0 GOSUB11 ENDIF 'pin2 is grounded to pin13
LOOP
END
C10
'Jog left code goes here
WHILE UAI==0 LOOP '1-shot
RETURN
C11
'Jog right code goes here
WHILE UBI==0 LOOP '1-shot
RETURN

 
Posted : 30/01/2013 11:59 pm
(@mikasv)
Posts: 4
New Member Guest
Topic starter
 

Thank you for the ultrafast reply.
If during the while loop (idle, no buttons pressed) I issue the motion command from the host, like

ZS
A=100
V=100000
P=1000
G

will the motor comply and then continue the while loop?

Thank you,

Mikas

 
Posted : 31/01/2013 1:45 am
(@csearcy)
Posts: 316
Reputable Member Guest
 

Yes it will.

 
Posted : 31/01/2013 6:39 am
(@mikasv)
Posts: 4
New Member Guest
Topic starter
 

Thanks very much, consider the issue closed.

 
Posted : 31/01/2013 6:48 am
Share: