Welcome, Guest
Username Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Control via I/O in competition with the Host

Control via I/O in competition with the Host 3 years, 8 months ago #796

  • mikasv
  • OFFLINE
  • Posts: 4
  • Karma: 0
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

Re: Control via I/O in competition with the Host 3 years, 8 months ago #797

  • csearcy
  • NOW ONLINE
  • Posts: 480
  • Karma: 23
Hi Mikas,
Is it a Class5 SmartMotor (firmware version 5.00 or higher)?
What is the part number?
Last Edit: 3 years, 8 months ago by csearcy.

Re: Control via I/O in competition with the Host 3 years, 8 months ago #798

  • mikasv
  • OFFLINE
  • Posts: 4
  • Karma: 0
Motor details (sorry for not adding before):

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

Re: Control via I/O in competition with the Host 3 years, 8 months ago #799

  • csearcy
  • NOW ONLINE
  • Posts: 480
  • Karma: 23
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
Last Edit: 3 years, 8 months ago by csearcy.

Re: Control via I/O in competition with the Host 3 years, 8 months ago #800

  • mikasv
  • OFFLINE
  • Posts: 4
  • Karma: 0
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

Re: Control via I/O in competition with the Host 3 years, 8 months ago #801

  • csearcy
  • NOW ONLINE
  • Posts: 480
  • Karma: 23
Yes it will.
  • Page:
  • 1
  • 2
Moderators: hsummer, csearcy
Time to create page: 1.67 seconds