upgrading to phidget 22: Stepper 1063, digital input

Comments & issues
Post Reply
mls3z
Fresh meat
Posts: 1
Joined: Tue Dec 07, 2021 4:20 pm
Contact:

upgrading to phidget 22: Stepper 1063, digital input

Post by mls3z »

I have a 1063 (discontinued) stepper that I'm trying to upgrade from phidget21 to phidget22. The person who did the programming has left, and this is the first time I'm trying to really upgrade/maintain this code.
-I have two major features that don't seem to have translated well to phidget22. There is a digital input on the 1063 that we are using to see if the stepper has hit the limit switch. I can't get this to work using the phidget22 "DigitalInputGetState" and can't find anything else that might work. What should I be using to tell if this limit switch is depressed?
-The second issue is that the code extensively uses the "StepperGetCurrentPosition" with phidget21. Is there something in phidget22 that can work like this? I saw a post addressing this, topic 8725 (I can't post the link). My code uses the StepperGetCurrentPosition extensively - I have two of the steppers to run an x-y scan, and will leave it at a position, exit the program, and would like it to know where it is when I open the program the next time.
Any insight on how to get this old stepper to work with the phidget22 upgrade to the system, or should I just roll back everything to phidget21?
User avatar
mparadis
Site Admin
Posts: 959
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: upgrading to phidget 22: Stepper 1063, digital input

Post by mparadis »

For the first issue, objects in Phidget21 that represented entire devices like the 1063 were split out into smaller objects in Phidget22. So instead of one Stepper object/handle that may or may not have digital inputs, outputs, or other things bundled in; you now have to have one object to control the stepper, a separate object to control the digital input, and another one to check the coil current.

You can check out our code samples page and select 1063 and your language of choice. Make sure one of the "digital input" boxes are checked, and the code sample will show you what it looks like to have separate objects in the same program.

For the second issue, Phidget22 added consistent rules for what a device will look like when it attaches. This means that states of digital outputs, settings, and other variables are reset to a known default value when opened. The downside of this is that if your program depends on the value of CurrentPosition (renamed simply to "position" in Phidget22) between attach/detach cycles you'll need to add some extra code. As mentioned in that other topic, you'll need to save those values somewhere when the program exits, and then load them back in when your program starts. The attach and detach handler is a good place to do this, and it is easy to write these values to a text file or csv. Just google search for "csv output" followed by your language of choice and you'll be able to find a code sample for this.

As to whether you should put in the work to upgrade to Phidget22 or just roll back to Phidget21- I highly recommend making the push for Phidget22, because we dropped support for Phidget21 a while ago, and it's getting to the point where many new boards (e.g. 1018_3, 1048_2) are incompatible with Phidget21 because they use newer processors which aren't supported in the old 21 libraries. Stepper controllers don't last forever, so this is a switch you'll have to make sooner or later.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 21 guests