07-29-2010 04:57 PM
Hi tbob,
Thanks again for your advices. It is working now!
Thanks a lot!
Cheers,
Anson
08-11-2010 03:27 PM
Hi tbob, Lynn and Dennis,
I have put the NI6009 and ULN2001A together and it seems to work fine. However, recently I have discovered a new problem. Whenever I restart my computer with the labview program, the digital output channels of the NI6009 seems to become 5 V by default even before I turn on the labview program.
It seems like one way to re-initialize it back to 0 V is to turn off the 5V power supply that goes to the SSR, then write a high signal (in labview) to the specific digital channel that I want to initialize back to 0V, then the problem disappear the next time I use the program and it stays that way. However, whenever I restart the computer again, the problem re-occur again.
Can someone give me some advice on how to make sure that the digital output channels of the NI6009 are always 0V except when I turn it on in labview?
Also, currently I have to manually choose the output channels everytime I use the labview program.Is it possible to save the settings in the program somehow?
I look forward to your reply, and thanks for your information in advance.
Cheers,
Anson
08-11-2010 03:42 PM
Anson,
The USB-6009 does not have a power-on default setting capability. It always powers on with the digital ports set as inputs. The inputs have an internal 4700 ohm pull up resistor to 5 V. That is what is causing your "outputs" to start high: They really are inputs pulled up! There is nothing you can do to change this behavior of the 6009.
If you cannot force the user to turn on the external power after you have powered up the computer, launched your program, and written initial values to the 6009, then you could add some external circuitry which detects a high-low-high sequence on a digital line and uses that to control a relay which switches on the rest of the power.
Lynn
08-11-2010 04:57 PM
Have the power to the ULN2001A be controlable by your Labview program (like a USB power supply, or any power supply that can be controlled by the computer, GPIB or serial. Your start up sequence should be:
Configure digital ports as outputs
Write 0 to digital port
Turn on ULN2001A power.
Or if the power supply is not controllable, then use a relay to switch the power to the ULN2001A on and off. Start off in the off state until your digital ports are configured.
08-13-2010 10:43 AM
Hi tbob and Lynn,
Thank you for your useful and prompt response as always. I am trying to initialize all the digital channels to 0 as the first stage of my program but somehow I have an error (please refer to the block diagram attached). For the input channels I am using "Dev3/port0/line0:7" so that all eight lines are to be initalized.
Can you please advise what could be the problem in the initialization stage?
Also, currently, I always have to manually set the output channels everytime I start the program. Is there any ways that I can have the program remembers the channels?
Thanks a lot!!
Anson
08-13-2010 10:54 AM
Anson,
I would guess that you're using the wrong version of DAQmx write. Your task has 8 lines, so writing a signal Boolean is not going to work. Try using DAQmx Write (U8 Port Format), and then wire the constant 0 to it as the data to write.
Hope that helps,
Dan
08-13-2010 11:56 AM
What McDan said was ture. Your error is due to you configuring an entire port (8 lines) and then sending only one bit. His solution will work.
However, when dealing with digital lines, I prefer to use booleans instead of a U8. It is easier to see what state each line gets. With a U8, you have to break down the number to its bits to see each line state. But for the purpose of just setting everything to a low state, the U8 will work fine.
Sticking to my preference of using booleans, see the attached picture for the proper way to initialize all lines low. Create a list of lines for the physical channel input. PXI-6225/port0/line0:7 will describe all lines on port 0 (notice the colon between line0 and 7). You could also list the channels separated by a comma (xxx/lport0/line0, xxx/port0/line1, and so on). Since you are using the lines individually later one (by looking at the code at the right in your picture), you would be better to setup the DAQmx Channels for "one channel for each line" at the very beginning, and using the task output for all subsequent actions. You would not have to create the channels again, as you are doing on the right side. Just pass the task wire to the next stage.
Also, in your picture you have the Start vi before the write vi. This is backwards. You need to write first, then start. Normally the write vi will not perform an output. It just loads the internal buffer with data in preparation for the start command. Now if you look at my picture below, you will see a True constant called auto start. This will tell the Write vi to start writing as soon as it gets its data. By using this, you don't even need the start vi.
08-13-2010 04:21 PM
Hi tbob and Dan,
Thanks for the advice!! I am trying to modify my program based on your suggestions now. However, I could not locate the function to create an array of boolean like what tbob has shown in the picture. Sorry for my lack of knowledge in Labview, but I still could not find it after reading the help files. I am using Labview 7.1 right now.
Can you please point me to the correct function to make a boolean array?
Cheers,
Anson
08-13-2010 04:41 PM - edited 08-13-2010 04:42 PM
The easiest way is to right click on the terminal on the DAQmx Write where the boolean array goes in. After right clicking, select Create - Constant. This will create the boolean array. The Create - Constant selection will always create the proper constant for that input or output. Then you have to expand the array to show 8 elements. Just point to the right edge and the cursor should turn into a double arrow (if using the auto selection tool). Then drag to the right until 8 boxes are showing. Now just click in the last box to the right and set it False. This should now display all the other boxes as False. This is a very basic function. Please study the online tutorials for Labview on NI's website.
Another way to create constants is to bring up the functions palette and go to the Array palette. In there you will find an array constant. Click on it and drop it on the block diagram. It will look like a black empty box. Then go to the Boolean palette and find the False constant. Click on it and drop it into the empty array black box. The array will change shape and size to match the boolean. Then expand the array to 8 elements and set them to False as described in the paragraph above.
After creating the array, you can then shrink it down to one element by using the double arrow on the right side and dragging it to the left until just one element is showing. The rest of the elements are still there, but it now takes up less space on the block diagram.
08-18-2010 10:07 AM
Hi tbob,
Thank you again for your advice! I have changed my write sequence as you suggested and the program is working now. As of now, I will force the user to follow the sequence of events as you suggested, rather than using a relay.
However, there is another problem and it only happens sometimes. If I use the program repeatedly, sometimes the NI6009 stops working. When I check the NI device monitor, the device is still recognized but it doesn't pass the self test. The only way I know to get it back working is to restart the computer.
Can you please provide some advice to me on how I can fix this?
Cheers,
Anson