11-05-2007 05:00 PM
11-05-2007 06:00 PM
11-06-2007
01:01 PM
- last edited on
03-27-2025
04:58 PM
by
Content Cleaner
Hello ILLGG,
Since at its basic level, SPI communication is just DIO, you can accomplish it with your PCI-6221, however it is slightly complicated. There are two ways to go about it, software timed and correlated DIO.
Software timed uses toggling of the lines and then your error cluster to control the order these lines change (so your lines change when you want them to). I found an example of this on another forum. This method is the most straight foward and easiest to program, however it is not terribly fast and the clock is not terribly consistant. It will work however.
Correlated DIO is a bit more complicated and harder to pull off, however it is hardware timed so it is smoother and faster. To to this, you basically have to write your digital waveforms so that everything lines up like it is supposed to, then you write this to the buffer and output it.
Just so you know, we also have a device specifically for SPI communication, the USB 8451. Hopefully this is the information you were looking for, post back if you have any questions.
11-06-2007 01:58 PM
Hi Neal M.
Thank you so much for your information. I tried to download the example you recommended as software timed way, but the vi version (8.2) is later than my current Labview version (8.0). I could not open it.
Since I just begin to learn Labview, I don't understand when you mentioned" your error cluster to control the order these lines change."
By the way, could you recommend more similar examples that I can learn from? I really appreciate your help. Thank you.
11-07-2007
11:21 AM
- last edited on
03-27-2025
04:59 PM
by
Content Cleaner
Hi ILLGG,
It looks like Tom W [DE] posted a LabVIEW 8.0 version of his example a little bit later in the day yesterday. Once again, it can be found here.
In LabVIEW a cluster is an encapsulating data-type that can contain multiple data values of varying data-types. If you’re familiar with C programming, it’s similar to a struct. An error cluster contains three values: status (Boolean) which can be used to detect if an error has occurred, code (integer) which is used to store the specific error that has occurred, and source (string) which is used to determine where an error has occurred. Since it is important to detect errors when programming, it is common practice to handle each VIs error clusters by wiring the error output terminal of one VI to the error input terminal of the next. Since the order of VI execution is determined by data flow (a VI won’t begin execution until it has received data on all of its input terminals), and because we want to handle all errors, we can control the execution order of VIs by wiring the error cluster in a desirable sequence. The example program controls the execution of digital I/O by wiring the VIs’ error clusters in a desirable order.
Since you’re new to LabVIEW, I recommend checking out a couple of NI’s online resources. I also recommend checking out the NI Developer Zone Tutorial: Learn 10 Functions in DAQmx and Handle 80 Percent of Your Data Acquisition Applications. Additionally, LabVIEW ships with a variety of examples. They can be found in the NI Example Finder. To open the Example Finder, select Help » Find Examples… in LabVIEW.
Finally, National Instruments offers training courses that would prove beneficial. If you’re interested in what opportunities are available for on-site and regional training, please post back.
Please post back if you have any questions. Have a great day!
11-08-2007 09:19 PM
Hi Ryan,
I really appreciate your help. Those information are very helpful. I looked at Tom W 's example and got a basic idea of software timed way. But I still feel difficulty programming my vi. Here is the details: I have the digital potentiometer AD 5290. It contains 3-wire digital interface
CS:Chip select input ,active low.
CLK: serial clock input . Positive edge triggered.
SDI: 8-bit Serial data input. Shift in one bit at a time on positive clock CLK edges. MSB loaded first.
I already defined CS as P0.0, CLK as P0.2, SPI as P0.1 in PCI 6221 DIO lines.
Thanks again.