From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parallel port and labview

Solved!
Go to solution

I am trying to control a OMHT23-400 stepper motor through a 3540M motor drive using a Moschip PCI Parallel Port. I created a program to send alternatilng pulses to the motor and rotate it a desired amount of degrees. The address of the stepper motor in my computer is I/O Range BD00-BD07. The same program worked in another computer who's parallel port address was I/O Range 0378-037F. I dont know why the program is working in the first computer and the same program wont work in this one. Thank you for your help.

 

 

PS: the program that i wrote is attached below.

 

Guillermo Naranjo

Physics/Space Science

Florida Institute of Technology

Phone: 768 537 6392

e-mail: gnaranjo2007@fit.edu

0 Kudos
Message 1 of 13
(6,324 Views)

It seems as if you are correctly specifying the address for the Out Port VI. The problem may be that you do not have data dependency established to control which Out Port runs first. LabVIEW does not execute left to right, top to bottom, or any other direction. A VI will execute once all of its inputs have been provided with data. Thus, in your sequence frame (which is unnecessary), there's no way to tell whether the left one or the right one will execute first. Typically the error clusters are used to establish execution order. See attached mod.

 

Other comments:

  • There's no difference between the True and False case.  The same values are wired to the "write value" inputs. This seems wrong to me.
  • Instead of using the Not function, simply flip the case elements.
  • Watch those coercion dots. Why wire a DBL to something that is expecting an integer?
  • You should always wire error clusters so you know if an error occurs.
Message 2 of 13
(6,307 Views)

Dear Gant88,

 

One reason for your VI not working might be the following:  function port out.vi  seems to accept the memory address as I16 data type (this is what I noticed in LabView 7.1). As long as your memory address is 0378 (in hex) is OK, but the upper positive limit for I16 is 7FFF. So your BD00 address is coerced or transformed to something else.

 

 I had this kind of a problem with my program for controlling stepper motors through parallel port: as long I was working on a PC (LabView 7.1) that had port address 0378 was OK. But then I switched to laptop that had parallel port on PCMCIA with FE08 address and I could not run motors any more. I checked the signals on the parallel port and realised that there are no changes or they are completely different from what I wanted to appear there. It took me several days to figure out the reason for this behaviour. Finally I used the accesshw library and made my own port in and port out that work fine on any memory address.

 

Actually all this is described here:

http://zone.ni.com/devzone/cda/epd/p/id/1132

 

In LabView 8.5 I noticed you can define the memory address as I32 as well.

 

regards,

 

Bojan

 

Message 3 of 13
(6,283 Views)

Excellent catch, Bojan. Learned it the hard way, huh? Smiley Wink

 

I suspect that if VISA were used to read/write the parallel port this probably wouldn't be an issue. 

0 Kudos
Message 4 of 13
(6,262 Views)
I tried installing the Access hw but it contained some errors and every time i open it there is nothing in the library. How could i use a VISA to solve the problem? Thank you guys again for your help.
0 Kudos
Message 5 of 13
(6,254 Views)

Bojan,

 

I am having the same problem you had with your laptop. How did you use the access hw to create your own port? I didnt understand very much the explanation. Thank you.

0 Kudos
Message 6 of 13
(6,249 Views)
Solution
Accepted by topic author Gant88

A search will yield lots of results. For example:

 

Using VISA to Access the Parallel Port in LabVIEW

Accessing Parallel Ports with VISA

Using the Parallel Port in LabVIEW (note that document's images are not displayed - this needs to be fixed by NI web site maintainers.)

Parallel Port Communication (this is just the VI provided in the the first KB article resaved for more recent versions of LabVIEW. 

...

 

 

0 Kudos
Message 7 of 13
(6,246 Views)
Have you tried the simple fix of changing the data and function to I32?
0 Kudos
Message 8 of 13
(6,243 Views)

Dear Gant88,

 

 first download and unpack accesshw.zip as instructed  (you can also unpack it to the directory where your .vi files for this projet are, thugh this is not good practice).

 

I attached my write_port and my read_from_port. (LV 7.1)

 

In my case I wanted to write (or read) 32 bit integer from the port, for this purpose I am writing (or reading) three (data, status, control) bytes at different locations. You will figure out.

 

Take care not to have any printer installed (in win xp) on parallel port, because windows will do some check-ups on printer from time to time. This will interfere with your program. 

 

 

Try and let me know.

 

 

regards.

 

Bojan

 

Download All
0 Kudos
Message 9 of 13
(6,239 Views)
I realize that all of these solutions will work in previous versions of windows. I know that since windows xp and Vista came out on the market, security was enhanced and communication with serial and parallel devices were not possible. Do you know if there is any way to get around that security for windows vista?
0 Kudos
Message 10 of 13
(6,160 Views)