Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

using compact daq to control a linear drive (stepper motor controller) through paralel cable

Hello

 

I am somewhat new to labview and working on a project to control a linear drive (I know C and machine language, but not labview). The drive is SMC LEFS with a LECP6 controller - LEFS and LECP6 datasheet (page 6).

This is a linear drive with a stepper motor and a controller with a option of control via a paralel cable (digital input and output signals). I connected all the signals to NI9425 and NI9476 cards.

My problem is that I don't know how to start.

I know all the sequences of the digital read and write signals for the operation of the drive (return to origin, absolute and relative moves, alarms,...). I just don't know how to approach the problem and where to begin... and for example how to buil a vi for a single operation, like return to origin (icorporates several readouts and writes of digital signal in a sequence).

 

I don't expect magic, but please give me some starting points, so that I may have at least some clue.

 

Thanks,

Best Regards,

 

Gregor Primc

0 Kudos
Message 1 of 6
(5,282 Views)

Hello grega, 

 

there can be some problems with this application, because both of your modules do not support hardware timing. This makes them not ideal for digital communication, specially for parallel communication. However, depending on the speed of the communication you might be able to read some/most massages correctly. I would recommend to start with examples for digital measurements and communication provided with LabVIEW. You can find them in Help -> Find Examples in LabVIEW windows. Also using the search engine on our website for queries like "Digital Communication" or "Digital Measurement" will show you informative results.

 

Forum1.png

 

Also it would be better for your application to use FPGA (cRIO Chassis) to implement the communication, but if you dont have experience in that it would be difficult. 

I hope I was helpfull, and ask away with any problems.

 

Good luck, Piotr

Piotr Kruczkowski
Certified TestStand Architect
Certified LabVIEW Architect
Message 2 of 6
(5,262 Views)

In hardware timing, you mean as in watch dog timer? I can still make a software WDT.

I have an idea of how to get the problem going. I will describe it and please comment on that.

 

When power is on, I'll check for any alarms. If there are none I'll move the motor to its origin and set a variable x=0mm (where x is the position of the motor).

 

I plan to have different sub vi's for relative movement of the motor for +1mm, +10mm, +100mm, -1mm, -10mm and -100mm. The main vi will call these according to user input of the motor movement. Each sub vi will track changes of the x variable and set it according to the desired movement. Also I can have a software alarm for out of stroke (if a user requests a relative movement, which is out of motor reach, I can generate a software alarm, before the actual movement begins and therefore prevent motor hardware alarm).

Also I will continually check for alarms. Whenever an alarm is introduced, according to the alarm group, I will write what is wrong and reset the motor.

 

This is somehow the basic concept. I am still not sure how to implement everything in labview, but in time...

If anyone has any ideas about the actual coding, please feel free to write them.

0 Kudos
Message 3 of 6
(5,232 Views)

When I say hardware timing I didn't mean watchdog. Hardware timing would allow you to specify a sequence of port data and drive the digital lines with a hardware clock without interfacing with software. If you do communication without hardware timing, you will have to drive the communication from software. In this situation tight time dependencies will be impossible to implement on Windows. 

 

Keeping this in mind, if all what you need is to push a button and send a finite amount of data, or wait for a trigger and read finite amount of data you can do it. The thing that you will not be able to achieve is deterministic time of sending data after reading, or reading data after sending. So back and forth deterministic communication will not be possible.

 

Understanding examples in LabVIEW and looking up additional examples on ni.com should be sufficient to implement the functionality that you can achieve.

 

Peter

Piotr Kruczkowski
Certified TestStand Architect
Certified LabVIEW Architect
0 Kudos
Message 4 of 6
(5,202 Views)

Ok, my idea is to use labview examples for writing and reading digital channels. I want to make a separate subvis, for writing to and reading from each digital signal and then implementing such vis in the code. I have a problem with having a while loop inside a subvi, since I cannot stop it. (I have 10 write signals and 12 read signals.)

Would it be better to implement (for reading signals) an edge detect function? For example when I move the motor, my busy signal goes high. And I just need to detect edge transition from low to high to know that the motor started to move, and when it stops again I have a edge transition detect from high to low (that the motor stopped moving).

 

Regards,

 

Grega

0 Kudos
Message 5 of 6
(5,171 Views)

Hello Grega,

 

Creating loops inside subVI will require some kind of communication method, going inside a loop, for you to be able to stop them manually. Examples of those are queues, notifiers, local variables, functional global variables, shared variables, control references etc. Please look into those, and you should be able to find a solution to your first problem.

 

The second issue is very specific to what you want to do in your system. I would recommend experimenting with different implementations and see which one works best. Since this is software engineering, often there is no best way to go, and you can achieve the same effect with different methods.

 

Does that help?

Piotr Kruczkowski
Certified TestStand Architect
Certified LabVIEW Architect
Message 6 of 6
(5,158 Views)