Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

PCI 6602 to control 4 stepper motors on a mechanised microscope.

Hi,

I am currently mechanizing an optical microscope and want to control the stages using stepper motors. 

I have stepper motor controllers that communicate with the motors but I need to input a clock pulse of which I can vary the frequency in order to control the speed of each motor.

I will also need to be able to send a high or low signal in order to control the direction of each motor 

 

I am using LabView 8 and have a PCI 6602 counter/timer.

 

I have used labiew before with a DAQ card (basicly using the DAQ Assistant module) but am finding this a bit more difficult .  So far I can have managed to operate one motor using a VI from the example finder called: Generate pulse train (NI-TIO).VI (attached). With this however I can't change the Frequency as the program is running. 

 

I have also used the NXT addons to control the NXT motors via the LEGO NXT block but that program isnt transferable to use with the 6602.

 

I wanted to ask if there is a better VI that I could use as a starting point than the example I have found.

Also having read some other posts I am wondering if there might be any problems generating two clock pulses at the same time e.g. to allow the x and y stages to move at the same time achieving diagonal motion.

 

N.B. The overall aim of the project is to also add a camera to allow remote controll of the microscope via the web but I dont think that it affects this stage of the development of the program.

0 Kudos
Message 1 of 11
(6,600 Views)

Hi Anthony,

What you are trying to acomplish should be reasonably easy using your hardware, and some fo the lower lever DAQmx functions.

I have written you an example VI that should be a good starting point.  It uses a standard state machine architecture to output at a set frequency, while running you can update your output frequency and then hit the "update" button to begin generating at the new frequency.

I have then copied the entire code for the second counter so the two counters can operate independantly and at different frequencies.

Have a play and let me know how you get on or if you have any questions.

 

Best regards,

------
John.P | Certified LabVIEW Architect | NI Alliance Member
Message 2 of 11
(6,571 Views)

Thanks for your help John,

 

I have tried to run the program you sent but it dosn't seem to recognise my counter/timer. Does the 6602 count as a DAQ device?

 

When I try to select a counter under counter 1 or 2 I only get a browse which leeds me to an empty box.

 

when I run it I get the following error:

 

Error -200220 occurred at DAQmx Create Channel (CO-Pulse Generation-Frequency).vi:3

 

 Possible reason(s):  Measurements: Device identifier is invalid.

Device Specified: Dev1

Task Name: _unnamedTask<14CC>

 

 

Am I making an elementary mistake somewhere?

 

I'll keep trying and let you know if I have any breakthroughs.

 

0 Kudos
Message 3 of 11
(6,559 Views)

Hi Anthony.

The 6602 is a DAQ device.  Looking at the example you were using it appears you were using the traditional DAQ driver.  My code uses the newer DAQmx driver.

Can you confirm you have DAQmx installed?

More than likely you just need to install / upgrade your DAQmx driver.

 

Have a look here for the current driver (8.9)

Let me know how you get on.

Kind regards,

------
John.P | Certified LabVIEW Architect | NI Alliance Member
0 Kudos
Message 4 of 11
(6,557 Views)

I have all the DAQmx tools so I assume I have DAQmx installed. 

 

Is it possible to have installed the tools without the driver?

 

I tried the equivalent DAQmx Vi (attached) to the one I used initially and again it doesn't recognize or allow me to select a device. 

 

 

 

0 Kudos
Message 5 of 11
(6,541 Views)

Hi Anthony.

The device can defiantly be used with DAQmx, I am using a simulated device but LabVIEW is more than happy to let me select the channels.  It is unlikely that you would have the VI's without the driver but it is possible.  Go into MAX and under software see if DAQmx is installed and check which version you have.  It may be you have an older version of DAQmx that does not support your device.  My advice is to simply install the latest DAQmx driver and this will more than likely resolve the issue.

 

Let me know what version you are running and if you still see this issue after an update.

Hopefully we are getting there!

 

Best regards,

 

John

------
John.P | Certified LabVIEW Architect | NI Alliance Member
0 Kudos
Message 6 of 11
(6,509 Views)

I also used 6602 last year.

you try this one .Good luck!

0 Kudos
Message 7 of 11
(6,492 Views)

Hi John,

sorry for not getting back to you. It seems my problems were mainly PC related. the hard drive was very small and I couldnt even install the driver update . I now have a new machine and have installed the update. 

 

Now I can use the DAQmx controls.

 

I just tried the original program you sent me and it works fine. Ill play around with it and let you know if I have any difficulties

 

thank you for your help

 

Anthony

0 Kudos
Message 8 of 11
(6,225 Views)

Hi I have been using johns VI from above and it is working ok.

 

Now I need to have better control of the motors.

 

As mentioned in the original post the ame is to control a microscopr with the motors. 

 

I am hoping to be abel to use a scrol bar or knob to control how far the motors turn but am not sure how to proceed.

 

Also I will need to produce a 5V signal in order to reverse the derection of the motors which again seems trivial but I havent been able to do it this far.

0 Kudos
Message 9 of 11
(5,678 Views)

Hi I have been using johns VI from above and it is working OK.

 

Now I need to have better control of the motors.

 

As mentioned in the original post the aim is to control a microscope with the motors. 

 

I am hoping to be able to use a scroll bar or knob to control how far the motors turn but am not sure how to proceed.

 

Also I will need to produce a 5V signal in order to reverse the direction of the motors which again seems trivial but I haven't been able to do it this far.

 

 Any help would be appreciated.

let me know what other information you need.

Thanks for your help.
0 Kudos
Message 10 of 11
(5,675 Views)