Driving stepper motor via parallel port
Hi everybody,
I want to drive a stepper motor via the parallel port. The problem is to
create a constant frequency on a digital line of the port. I tried to do
so with a While-Loop with a certain delay, but the frequency varys due
to occurrences like mouse-movement (due to the call-ups of interrupts I
think).
Any Ideas?
Regards
Martin
Attachments:
Martin.Eis.vcf 1 KB
How about a simple NE555 timer circuit to externally create the constant
frequency, then use a bit in the parallel port to enable and disable the
NE555 circuit? You could probably go to Radio Shack and pick up the
components for less than $10.
Jim
Martin Eis wrote in message
news:[email protected]..
> Hi everybody,
>
> I want to drive a stepper motor via the parallel port. The problem is to
> create a constant frequency on a digital line of the port. I tried to do
> so with a While-Loop with a certain delay, but the frequency varys due
> to occurrences like mouse-movement (due to the call-ups of interrupts I
> think).
>
> Any Ideas?
>
> Regards
> Martin
>
Similar Messages
-
Servo motor using parallel port
Hello,
I have a XY mirror scan Servo motor used for optical scanning experiment.
The question I have is:
I already have a program to control stepper motor via parallel port. Can I use the same to control servo motor ?
Or is the SERVO motor concept different to that of a STEPPER motor ...
Thank you
Abhilash S Nair
Research Assistant @ Photonic Devices and Systems lab
[ LabView professional Development System - Version 11.0 - 32-bit ]
LabView Gear:
1. NI PXI-7951R & NI 5761
2. The Imaging Source USB 3.0 monochrome camera with trigger : DMK 23UM021
OPERATING SYSTEM - [ MS windows 7 Home Premium 64-bit SP-1 ]
CPU - [Intel Core i7-2600 CPU @ 3.40Ghz ]
MEMORY - [ 16.0 GB RAM ]
GPU - [ NVIDIA GeForce GT 530 ]You will need a DAQ card that can generate the voltage needed to send a command signal to the 671. The 671 will need to be tuned to the 6880 with whatever sized mirror is attached. (If you bought the galvo and servo driver as a package it should already be tuned.)
CTI systems take in an analog command from -10 to +10 Volts. Almost all the NI DAQ cards (and many other brands) output +/- 10 Volts so that will be easy.
Then you will need to decide how to scan your target. A ramp pattern or triangle wave is the usual choice for scanning objects so you need to generate that in LabVIEW code along with the code that will read your sensor. This should be done simultaneously but you really don't need a very expensive DAQ card to accomplish that. Look on the NI website for options in your price range and do some research...
Is your system one axis (one 6880 and one 671)? If so you will scan a raster (ramp or triangle) to measure a single line of light intensity, move the stage a tiny distance and scan another line. When you put all the lines together into a 2D image you will have a representation of one face of your object. Many people use a rotary stage to spin the object while scanning to assemble a 3D model of the object. This is a bit more complex of course.
Using LabVIEW: 7.1.1, 8.5.1 & 2013 -
Sending out a signal via Parallel port in interrupt mode?
I am trying to send out a 5KHz TTL signal via parallel port. the CPU should be disturbed at most time. so we can't use loop structure. I guess I have to use interrupt mode to do this job.
In other languages, we might be able to programm 8253, which is a timer and counter chip on mother board. can we generate a 5KHz siganl via parallel port without disturbing CPU?
or can we call another labview program in our main labview program.by doing so, two programs are running at the same time, we may be able to solve my problem
ThanksHi Sean-
This functionality is theoretically possible, but this might not be the best option if you are concerned about latency in operation. A few references for using the parallel port in LabVIEW are linked in this thread.
If you are concerned about precise timing and operating system latency issues, you may want to consider a hardware-timed PCI counter/timer board instead. This utility is a good starting point for selecting such a card.
Tom W
National Instruments -
Hello, first to
apologize for my bad English
I made a program for
driving a stepper motor CW and CCW with pulse.
I used USB-6008 for
sending pulse to a motor driver..
Now I’m making a program for driving a motor with typed in
code:
F=4 // Forward
(CW) 4 steps
B=12 //Backward
(CCW) 12 steps
S=2000 //Speed 2000
B=2 // … and so
on…
Parser splits this code in 2 array’s then determinates a tip
of command and then sends them to a block for driving a motor..
PROBLEM: Motor
driving block is not responding ()
(In Motor driving block Instead of pulse generator I’ve putted a random number
generator. Just to avoid constant connecting a hardware )
Pleas help mi solve this problem. Thanks in advance !
Attachments:
Step Motor Bot.vi 82 KB
Motor.vi 139 KB
Parser.vi 30 KBStep Motor bot only runs once.
If you pick Auto and run it, the block gets parsed into two arrays. You pick out the first row of the array and send that to STM. But there is nothing left to loop back and and set the other values in your parser. Turn on Execution Highlighting and run it. I'll think you see what is going on.
I think you still need to rethink your architecture. I think the Action Engine nugget would help you figure out what you want to do.
Message Edited by Ravens Fan on 02-02-2009 05:49 PM
Attachments:
Step Motor Bot_BD.png 19 KB -
Setting Pins on Parallel Ports
Ok - going crazy - am trying to run a motor via parallel port - have a basic c app that does this but need to translate it into java. The code runs fine but no data is getting to the motor. Have tried with both a PrintStream and BufferedOutputStream but neither work (if they are in fact the prob)- this is what i have for the write methods.
public void getOutStream(){
bos = null;
try {
//bos = new BufferedOutputStream(port.getOutputStream());
pos = new PrintStream(port.getOutputStream());
System.out.println("_GET_OUTPUT_STREAM_");
} catch (IOException e) {
e.printStackTrace();
public void write(){
int [] b = {0x19, 0x39, 0x13, 0x33, 0x16, 0x36, 0x1c, 0x3c};
for(int i=0; i<b.length; i++){
pos.write(b);
//bos.write(b[i]);
delay(500);
Have checked out the forums and a couple of people have mentioned setting the pins on the port to set values - how and where can i do this? and will it do the trick? Maybe someone can see something wrong with the code that i've missed?
Any help will be HUGELY appreciated - cheersYou must to forces the buffered output bytes to be written out to the underlying output stream.
To do this use the flush method.
public void write(){
int [] b = {0x19, 0x39, 0x13, 0x33, 0x16, 0x36, 0x1c, 0x3c};
for(int i=0; i<b.length; i++){
pos.write(b);
//bos.write(b);
// put here if you want to flush after write one byte.
bos.flush();
delay(500);
// or here if you want to flush only after write all bytes.
bos.flush();
} -
Stepper motor input pulse problem
Hello
I've purchased 4 autonics a41k-m599 model 5-phase stepper motors and 4 MD5-MF14 model drivers. I want to pulse the drivers via parallel port with c++. Now I have some serious problem, first I can't get a higher speed than 666 pps (1500 microseconds interval), second and more important when I send pulse to driver I see motors rotate smoothly but in some moments (and not regularly) they produce some small pauses which result in some small shakes or vibrations. Here I send you a scrap of my c++ code:
// ten cycle
for(int iLoop = 0; iLoop < 10; iLoop++) {
// 500 step to complete a cycle (each step is 0.72 degree)
for(int j = 0; j < 500; j++) {
outp(LPT1, HIGH); // send HIGH to CW through LPT1
outp(LPT1, LOW); // send LOW to CW through LPT1
DelayMicroSleep(1500); // delay 1500 microseconds as pulse interval
Here's a picture of my driver's time chart and input pulse specifications:
http://lh4.ggpht.com/_sFND_wFW_Qo/SttpJRzLpKI/AAAAAAAACGA/uRNWYH519dU/s800/StepperMotorTimeChartPuls...
So now what could be the problem?Should you not have a delay between sending the high and low pulse? Otherwise the pulse will happen very quickly.
// ten cycle
for(int iLoop = 0; iLoop < 10; iLoop++) {
// 500 step to complete a cycle (each step is 0.72 degree)
for(int j = 0; j < 500; j++) {
outp(LPT1, HIGH); // send HIGH to CW through LPT1
DelayMicroSleep(hightime);
outp(LPT1, LOW); // send LOW to CW through LPT1
DelayMicroSleep(1500); // delay 1500 microseconds as pulse interval
nrp
CLA -
Using BNC2110 DAQ In Order to Control Stepper Motor
So basically my goal here is to use LabView to control the direction and the steps of the stepper motor.
I have BNC 2110 (connected to PC), Lin Engineering's 4218M-54P-04 Stepper Motor, and Lin Engineering's R701 Stepper Motor Driver.
The specification documentations are attached.
I know that the driver and the stepper motor are compatible.
Is it possible to control the motor through Labview(PC) < - -> BNC2110 < - -> R701 Driver < - -> Stepper Motor, without the motor's own controller?
An example of a controller for this particular motor would be on this website.
I would much appreciate your support.
Thank you.
Attachments:
4LeadBipolarSteppingDriver-linengineering--4218m-54p-04.pdf 652 KB
DriverR701.pdf 379 KBHi jhprks,
It would appear that the stepper motor controller that you list communicates via RS-232 or RS-485. You can make serial calls in LabVIEW using the Serial or VISA commands. It could be something to look into.
Further, we do have a multitude of ways to accomplish this with our hardware; here are a few resources to take a look at, with the first being an example of how to do this with a multifunction DAQ device:
Using Software Timed Digital IO to control a stepper motor with DAQmx:
http://decibel.ni.com/content/docs/DOC-6385
Stepper motor control via Parallel port:
http://zone.ni.com/devzone/cda/epd/p/id/3611
High Performance Stepper/Servo control:
http://sine.ni.com/nips/cds/view/p/lang/en/nid/10026
Stepper Motor Theory of Operation:
http://zone.ni.com/devzone/cda/ph/p/id/248
Stepper motor Drives:
http://sine.ni.com/nips/cds/view/p/lang/en/nid/3308
Adam
Academic Product Manager
National Intruments -
Hi,
I'm using LV 7.1 Pro under Windows XP. I can use a PCI 6602 card and also a PCI MIO 16 XE-10. I must drive a stepper motor via a specific driver : Philips TJA1010. This driver is working with a clock at ~7 Khz used as timebase and it has a serial data input that will activate the differents driver outputs connected to the stepper motor to create the rotation.
The sequence order to send via the serial data input is described in the attachment. The problem is to be able to generate this sequence on the serial data input. I already checked on the forum and found the .vi attached but I don't see how to create my sequence.
Thank you in advance for your help
Attachments:
drive stepper motor.vi 139 KB
cycle_stepper_motor.JPG 72 KBHi pasolo,
I'm not familiar with the TJA1010, so I'm assuming for this post that you have already hooked up one of the digital lines from your DAQ card to the input on the motor driver.
From what you describe, it sounds like you want to do a specific pattern generation on an external clock. There is actually a great example for that in the NI Example Finder. Just open LabVIEW and go to Help >> Find Examples. From the Browse tab, go to Hardware Input and Output >> DAQmx >> Digital Generation >> Cont Write Dig Port-Ext Clk. This should allow you to write a pattern of 0s and 1s that correspond to your required waveform. Also, some of the other examples in there might be helpful to look at as well.
I hope this helps!
Thanks,
Justin M.
National Instruments -
Hi,
I`m desperately in need of your help.
For my school project, I`m trying to write a labview code in order to acquire air pressure data by using 8-bit analog digital converter via parallel port. Although my signal frequency very low -100 Hz-I think I experience sampling rate problem. I want to put sample rate and frequency data in my code but how can I put it in my code?I `m giving square waveform via function generator which I need to see it on my graph in Labview. But there is something wrong in my signal in waveform chart. You can see screenshot and code attached. . Also there are some noises and amplitude is not stable . How can I fix this?
Would you please have a look at to my code and tell me how can I set sample rate and frequency?
Attachments:
CAN1.VI 21 KBHi LW-s
There isn't really a way to set the sampling rate for these VIs. You will have to use software timing. The only way to do this is with 'wait' functions inside your loop. You can also implement some logic to smooth/adjust your waveforms. For a square wave the logic is pretty simple. If the input value is above a threshold store it as the max and if it is below the threshold store it as the min. (See the example below). For sine waves this is a bit more difficult and if I were you I would probably try to implement some sort of averaging.
Best Regards,
Chris J
Message Edited by ChrisJ on 08-23-2005 05:31 PM
Attachments:
example.JPG 86 KB -
Hi, i will use labview for my thesis project and i plan to input my data via parallel port.
My input data is 8 bits so i tried to use control and status lines of the parallel port.
I used the method that is described at NI`s developer zone web page which shows using control and status lines.
http://zone.ni.com/devzone/conceptd.nsf/webmain/72c6fc6ce4ad4d1386256b1800794596?OpenDocument
By using that method i achieved to input first 4 bits of my data over status lines while there were no change at those of control lines.
Because my data that i want to input consists of 8 bits, i could only be able to manage half of it.
what can i do for using control lines?
Or as a second alternative, is there any way to input 8 bits over data register?
Below i have attached the code that i had written to input by using control and status registers.
Attachments:
can1.vi 30 KBWell, I looked at your VI and it looks like you have everything setup right. The only thing I can think of is that you are not grounding the control lines when you want to set them low.
As far as your second question is concerned some parallel ports can be bidirectional. The article that you provided explains how you can test if you parallel port is bidirectional, and gives an example on how you would read and write from the data bits.
Also, you may want to try the two parallel port shipping examples in LabVIEW. There is one that uses the data bits, and one that uses the status and control registers. You can find these examples by going to Help>>Find Examples, then search for Parallel.
Shawn B.
National Instruments
Use NI products on Linux? Come join the NI Linux Users Community -
There are stepper motor vi and sequence vi at the attach file. I want to control stepper motor via sequence vi. When I run the stepper motor vi, it can not be reached part of enter position. How can I integrate sequence vi into the stepper motor vi.
Attachments:
Stepper motor.vi 24 KB
Return Code Insertion.vi 14 KBSequence vi.
Attachments:
Sequence.vi 10 KB -
Control of DMX J SA 17 stepper motor in Labview
Hi,
I'm trying to build a simple program to control an Arcus Technology DMX J SA 17 stepper motor via USB. I'm basing my program on the example which Arcus provide on their website, and which I attach in an llb (the program is demo.vi, the rest are sub vi's).
The motor also comes with a piece of standalone software for controlling it, and this program works fine - which implies that there is no problem with the hardware or connection.
The problem I'm having is that when running the demo, having input some arbitrary positions for the motor to turn to, it returns error 8004:
"LabVIEW: An input parameter is invalid. For example if the input is a path, the path might contain a character not allowed by the OS such as ? or @.
=========================
NI-488: Command requires GPIB Controller to be Controller-In-Charge."
The error is confusing because the control mechanism does not use GPIB hardware or commands, also the VI was made by Arcus and I would have expected them to handle the formatting of the data inputs correctly.
Any help would be much appreciated
Dan
Attachments:
PerformaxLV_v102.llb 500 KBHi Jack,
Thanks very much for your help. I've managed to complete the VI now, working as was intended. The principle problem came from trying to use demo.vi as a standalone - it turns out all the vi's in the .lib are sub-vi's apart from utility.vi. This was of course, not at all clear - and I've emailed Arcus recommending that they includ some descriptive documentation with the .lib download.
What was happening was that demo.vi was trying to send commands without having first established a communication channel, which is done by two other sub-vi's in sequence (device selector and open device). Also, once communication is established, the motor needs to be sent the command string 'EO=1' to be enabled.
I attach the final vi I made 'motor control' and the sub vi library, incase anyone working with the same hardware finds them usefull.
Thanks again,
Dan
Attachments:
Motor control.vi 92 KB
PerformaxLV_v102.llb 449 KB -
Hi All,
I followed the instructions on this link
http://zone.ni.com/devzone/conceptd.nsf/webmain/72C6FC6CE4AD4D1386256B1800794596,
in an attempt to drive a stepper motor. I used the VISA method and grounded pins 12 and 13 and tried to obtained some output with no success... Is there any other pins that I should take care of other than the data pins 2-9 and pins 12,13. I am using a mulitmeter to measure the voltage of the output data pins. I also tried the register method by using the outport.vi but also without any success. Both vis I written does not give me any errors. I tested the parallel port on a printer and it seem to be working fine. Perhaps I had missed out something? An early thanks for anyone who could enlighten me on parallel
port output.Hello;
You don't need to worry about any other pins than the ones you described. The best way to trouble shoot that is by using a Scope to catch the output line of the parallel port and to have a really simple VI just writting a high level state on that line.
Regards
Filipe A.
Applications Engineer
National Instruments -
I'm using a compumotor S6 drive and I was wondering if I could somehow use Labview to program the parallel port to send the required step and forward backward signal to the controller and motor. All I need it to do is go back and forth at a user defined rate. Considering I know very little about Labview this is a daunting task indeed.
Hello Tiano!
I found an example on the www.ni.com website named "Reading from the Bi-directional Parallel Port."
Here is the link: http://sine.ni.com/apps/we/niepd_web_display.DISPLAY_EPD4?p_guid=B123AE0CBA4C111EE034080020E74861&p_node=DZ52058&p_submitted=N&p_rank=&p_answer=&p_source=External
Hope this and the other documents help you along your way!
BB_Phil -
I am trying to use the parallel port on a win xp machine to send data a@ up to a 3k rate. This is for the the purpose of driving a stepper motor. I have tried the port.out vi and placed this vi in a loop and it on a scope it looks like I am limited to a a 200hz rate. What am I doing wrong??? Can labview do this or is it too slow ???
Thankssnook wrote:
> what is the data throughput in labview. I want to use the parallel as
> acheap digital i/o to drive a stepper motor.
>
> I am trying to use the parallel port on a win xp machine to send data
> a@ up to a 3k rate. This is for the the purpose of driving a stepper
> motor. I have tried the port.out vi and placed this vi in a loop and
> it on a scope it looks like I am limited to a a 200hz rate. What am I
> doing wrong??? Can labview do this or is it too slow ???
Basically the way the Port I/O VIs are implemented they call through a
device driver for each port access. This slows down the maximum port
accesses to something like 1000 times per second depending on the speed
of your CPU.
There is a way to do it faster but that is a little more trick
y. The
idea is to use a device driver to enable particular port addresses to be
accessed directly from the application level instead of always going
through the kernel.
I have written such a VI library and accompagning DLL and device driver
and made it available on OpenG. It is not yet part of the standard
binary distribution packets so you will have to get it from the CVS
repository.
Go to:
http://cvs.sourceforge.net/viewcvs.py/opengtoolkit/portIO/built/portio/
and download all the files in there including the ones in the
subdirectory "ogportio.llb" and if you like "docs"
If you want the nitty gritty technical details you can also look at
http://cvs.sourceforge.net/viewcvs.py/*checkout*/opengtoolkit/portIO/c_source/Description.htm?rev=1.5
On my 866 MHz Pentium mobile I can increase the number of port accesses
in this way from 440 ms for 4000 read byte port accesses (100us ms per
access) to 20 ms for the same number of read accesses (5 us per access).
Rolf Kalbermatter
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions
Maybe you are looking for
-
I have three questions. Count em'... 3!
Question #1 (my firts question)(out of three) Is there a way you can bounce multiple logic files and put them all on one cd. I'm starting to run out of blank CDs! Question #2 (my second question) (out of a total of 3) I saw a program where you can sp
-
Color Printing on High Gloss Paper
I'm using an HP Photosmart Premium All in One (C309a). I am printing a camouflage pattern, with a lot of color on top of color, using high gloss transfer paper. The variations in color are getting lost on the high gloss although it prints out just f
-
I have a MacBook from 2009. It is a 3.06 GHZ Intel Core 2 Duo. I am considering getting the new MacBook 2.7GHZ i7. Is that better?
-
Can We Create New Categories and Folders?
I hate having all of my apps piled up in the "ALL" category. Can we create new categories such as "Business Apps" or "Education" in order to stay organized? If not can we at least create folders within the existing catefories? Solved! Go to Solution
-
Stopwatch - doesn't freeze, but goes into "power save"
What am I missing? I have started using my iPod's stopwatch to time my daily walks -- and, lately, after walking a bit, I look down and the screen is black. I press a key to bring it back to life, and the stopwatch has STOPPED. What good is that? I r