03-16-2018 04:34 PM
Hello,
I have a problem with a program of my DAQ USB 6501.
The program is a multiplex program in which I have to set 17 adresses (binary) on the DAQ port.
I could easy fix this with selecting the whole port . But then I lose three lines, and I really need those.
E.g: Numeric 8 would give 00001000 on the whole port
So is there a way to select only a range from: line 0.0 to line 0.4 and controlling them like I did with only selecting port 0?
Thanks a lot!
Greetings,
Joran
03-18-2018 12:54 PM
I'm not completely sure I know what you want to do. The 6501 has 3 8-bit Digital I/O ports, so by doing 3 DAQmx Writes, you can set 3*8 = 24 Digital Outputs (and if you only want to use 17, don't wire the remaining 7, or set them to all 0's).
Do you want to program them by setting a single U32 number and have its low 17 bits sent to the three ports? You can use the Split Number function (three times) to get this split into 4 bytes (or use a TypeCast to change the U32 to an array of 4 U8s), then send the low 3 bytes to Ports 0..2.
If you want to do "something else", please explain more clearly what you want to do (and don't worry about the "how").
Bob Schor
03-18-2018 01:45 PM
The address I want to set on my DAQ is only 5 bit long ( I only want to use 5 lines). The number 17 isn't really important.
This number means I want to set an address until number 17 (decimal), so until '10001'.
But I think I've already solved the problem by setting 5 DAQ assistants and converting the numeric into a Boolean array and uploading every single bit separately to the lines
I thought there was a more ergonomic way of doing this (with less blocks). That way, I still haven't found.
But thanks for the answer! It works now, but if you know a better solution...
In the file you can see the way I tried to solve it.
03-18-2018 03:09 PM
Perhaps this will slow the program down and speed is really important.
03-18-2018 08:40 PM
Wow! You really need to learn LabVIEW, the idea of Data Flow, get rid of the Sequence Frames, use Shift Registers, etc. I still don't quite understand how you use an index (1 .. 17) to select patterns from 5 channels (namely "why stop at 17? Why not allow 31 activation patterns?).
So here's a question -- in the first iteration of the For loop, when the Index is 0 and this evaluates to 00000, which I presume turns all 5 channels "off", do you really want to do this? Do you have an "off-by-one" error?
Learn some LabVIEW. Learn about Loops. Learn to "almost never" use Local Variables, preferring Shift Registers (and maybe not feeling you need to show all the intermediate values on the Front Panel -- use a Probe instead).
Bob Schor
03-19-2018 01:23 PM
Number 17 just stands for the amount of inputs I want to multiplex.
I started LabVIEW last year, and I only know the basics.
I'll do some more research. (Shift registers etc.)
03-19-2018 03:18 PM
Here's a little routine you might find amusing/instructive for your Multiplexer. It indexes through the 17 Multiplexer channels (starting with Channel 1, ending with Channel 17).
Next, there's a loop that indexes through the Multiplexers chosen bit-wise by the Multiplexer Index/
Finally, we get an array out, sum the array, and get "N".
Here's a Snippet, and I'll also attach the VI (in LabVIEW 2016, but it's so simple you can code it yourself).
Bob Schor
03-21-2018 11:49 AM
Alright.