02-13-2009 01:44 PM
Melody -
I will combine Points 2 and 3, cause they are related to the same issue. For The PWM signal you need to have that signal set for 'one channel for all lines' and it will need to be on its own port (i.e. Port0). Now for ENA and DIR you can have those set to 'one channel for each line' (as they are capable of being on the same port) you will also need to change the DAQmx Write functions for ENA and DIR to Digital>>Single Channel>>Single Sample>>Boolean (1 line), and when you set the physical channel you must have it set to a specific pin for each input. (Example: ENA = 'Dev1/Port1/line0' and DIR = 'Dev1/Port1/line1'). This will write only to that one line on your board. Also for the ENA pin there is no need to have the DAQmx Write function in a while loop if the value will never be changing. You could just get rid of the while loop and make sure it doesn't execute the DAQmx Clear Task until after you have decided to stop your program.
As for point 4, you could use a For loop instead of a while loop and then have a control on your Front Panel that would set the number of iterations that the For loop would execute. Then once the For Loop had finished executing you would just have to run the VI again to run the motor.
It seems to me as you are making pretty good progress with the program. Let me know any other questions that arise.
02-15-2009 09:49 PM
Hi Aaron,
Hope you had a great weekend!
02-16-2009 05:11 PM
Melody,
I hope you had a good weekend as well, I feel that an extra day on the weekends would be great and am trying to find a way to make that happen.
How exact do you need to Load Cell and the PWM signal to start with each other? Are we talking within the same second, or are we talking milliseconds? Lets take a step back and talk about the overall needs of the program as a whole. This is what I understand so far:
- You need to be able to output a software timed PWM signal.
- While you are outputting a PWM signal you need to be taking data from the load cell.
- You need to be able to control the ENA and DIR lines while all of this is taking place.
- You need to be able to save the Load Cell data to a file while all of this is taking place.
- You also need to be able to write what step count the measurement was taken into the file.
This is a fairly in-depth program and I just wanted to make sure I know exactly what you need to do to get the program up and running. As it stands right now the code you are using does not have a good data flow because there are essentially 4 parts of the program operating independently from one another. If you could give me more of an overview of what the program needs to do overall, it would help greatly.
You also mentioned about being able to run the PWM over again and still be able to take load cell data continuously, are you wanting to append the data to the file you are saving so you can have a consistent log of data from when the PWM signal is being run?
02-16-2009 09:57 PM
Hey Aaron,
I know some companies do take off today. I'm sorry you didn't. Me either.
Here is the big picture of my application.
Overall is an loading and unloading test. Stepping motor( drived by 3rd party board which requires D I/O from USB-6501)is used to generate motion while NI-9237 recording the load cell data. Set up the steps numbers , frequency for the stepping motor, then start motor motion and load cell data acquisition together. When the motor finishes the preset number, motor motion and load cell data acquisition stops together. After 5 to 10 minutes, restart the motor drive and load cell data acquisition without the offset nulling calibration again, say let the load cell stay in 'pause' not 'stop' status during the hold period(I can rerun th VI as long as the load cell doesn't change offset). Then after several runs , I will change the direction of motor and do the unloading. I would like to save all the load cell data according to time and motor step number in one file including each run.
All the points you list is correct 🙂
- I need to be able to output a software timed PWM signal control the frequency and steps of motor.
- While I'm outputting a PWM signal I need to be taking data from the load cell.
- I need to be able to keep the ENA on while all of this is taking place. I need to control DIR during this is taking place or between run.
- I need to be able to save the Load Cell data to a file while all of this is taking place.
- I also need to be able to write what step count the measurement was taken into the file.
1) I do want to append the data to the file I am saving for each run. So the PWM and load cell should be both on or both off.
2) I try to use' local variables' to stop the load cell when the PWM stops. So I added a local variables(stop 2 which can stop load cell reading) to the PWM status, but it popped up an error: Boolean 'stop 2' latch action is incompatible with local variables. If a Boolean control has associated local variables, it cannot use latch mechanical action. The first local variable to read a Boolean control with latch action would reset its value to the default.
I would appreciate if you can do some correction for this in my VI. I am confused about how this 'local variables' works
3) The load cell recording should begin from 0. I tried to keep offset nulling on the first run, and then turn off offset nulling before I rerun the VI, but the reading totally changed from -2 to 0.8. I still need suggestion for this step.
4) My concern about putting steps from PWM to load cell file is the different data frequency and compatibility.
Appreciate your time and effort!
Melody
02-17-2009 04:03 PM
Melody,
I see that you had been talking to John P on another forum linked here. John actually sits by to me and we have been talking about this issue. The last iteration of the program that he gave you was a very good program that should work well for you. As I am sure you have figured out LabVIEW is very powerful/flexible software and there are often many ways to write the same functionality. If you can tell us what isn't working with the current version of the code we will help you debug from there.