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
Hi Mikas,
Is it a Class5 SmartMotor (firmware version 5.00 or higher)?
What is the part number?
Motor details (sorry for not adding before):
FW: 478T
Model: SV1720-PLS
Serial#: G18144
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
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
Yes it will.
Thanks very much, consider the issue closed.