01-06-2022 08:30 AM
Hello,
I am working on a program that will run the same test over multiple channels. Sequence that I am looking for is: Enable channel, run test, record data, enable next channel, run test and so on.
I am using USB-6343 Multifunction I/O Device to trigger relay channels “Diodes Tested”. I am struggling to get the channels to enable one at a time. I have tried this using shift registers with bullion array but did not work in a sequence.
Any help is greatly appreciated!
Thanks,
Mike
01-06-2022 12:30 PM - edited 01-06-2022 12:34 PM
Hi Dzordan,
@Dzordan wrote:
Sequence that I am looking for is: Enable channel, run test, record data, enable next channel, run test and so on.
I am using USB-6343 Multifunction I/O Device to trigger relay channels “Diodes Tested”. I am struggling to get the channels to enable one at a time. I have tried this using shift registers with bullion array but did not work in a sequence.
You should better name it "statemachine" instead of "sequence": you may think about adding more states to implement your required "sequence" of states…
What is a "bullion" array? Are you talking about the boolean array labelled "Diodes Tested"?
When you want to enable just one of those two diodes then you should use a boolean array of two elements and set both to FALSE. Then you can set the first or the 2nd element to TRUE as needed. And why do you use a local variable of that array for DAQmxWrite when you should use a shift register instead?
(Right now you increment the integer value in a shift register, but then you convert that value into a boolean array. Why do you expect "only one enabled" boolean this way? Do you know how the conversion from integer value to boolean array actually works?)
Btw. you should not use InRangeAndCoerce on a string input: use IR&C on the float value after conversion from string!
01-06-2022 03:16 PM
Hi GerdW,
Thanks for the reply!
The program needs to be able to test 18-25 diodes/channels, I was hoping there is a better way to do this than making a separate case for each.
I used local variable because I did not know how I can use shift register to enable each channel individually. When I convert integer to Boolean array it counts in binary so when converted:
CH “1” would be T,F, CH “2” would be F,T but for channel “3” I am getting T,T,F - which makes sense but not what I need, I get both CH 1 and 2 on…
Any suggestions on how to achieve this?
Thanks,
Mike
01-06-2022 04:31 PM
So, you're controlling relays using DAQ DO to switch each diode to connect with SMU.
All you need is a simple bitwise operation or logical shift to set only the appropriate channel and reset all others.
01-07-2022 09:41 AM
Santhosh, I implemented your idea using a local variable, I can see the bit shift is working correctly but the channels still do not trigger. Also, I am now seeing an error -200524: Number of Channels in Task </B>2, Number of Channels in Data </B>32. It’s not liking that there is a mismatch in channel number.
Any thoughts? - Thanks
01-07-2022 01:11 PM
Hi Dzordan,
@Dzordan wrote:
Santhosh, I implemented your idea using a local variable, I can see the bit shift is working correctly but the channels still do not trigger. Also, I am now seeing an error -200524: Number of Channels in Task </B>2, Number of Channels in Data </B>32. It’s not liking that there is a mismatch in channel number.
Any thoughts?
Thoughts:
01-07-2022 01:18 PM
I do not know how to use shift registers to make this work correctly, therefore I tried using local variable.
Code Attached:
Thanks,
01-07-2022 01:23 PM
Hi Dzordan,
@Dzordan wrote:
I do not know how to use shift registers to make this work correctly, therefore I tried using local variable.
Then you (REALLY) should step back and return to those "Training resources" offered at the top of the LabVIEW board!
Using shift registers is very basic LabVIEW stuff!
@Dzordan wrote:
Code Attached:
You define your DAQmx task to contain two DO lines, but you create an array of 32 elements with the NumToBoolArray function. The same can be seen in the images provided by Santosh!
I recommend to limit that array to just two elements: learn to use LabVIEW array functions and that task is solved within seconds…
01-07-2022 08:56 PM
You need to subset the boolean array based on the number of channels in your task.
01-14-2022 02:46 PM
I can not get this to work properly. I am having issues inserting/replacing the array using the logical shift so channels enable/disable in a sequence. Possibly my approach is totally wrong...
Any examples or hints would be helpful.
Thanks,