LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to assign each BitNum for each button?

Actually, I am doing a interface to control variable gain amplifier through a DAQ namely PMD-1208FS(Measurement Computing Product). But, the interface is not really desired. This is because before I want to click a button, I need to set it's BitNum and then it can send 5V signal to the hardware. Ideally, I want click a button and straight forward send a signal. Do you have idea of this?T

I have attached my interface and labeled each BitNum for each button The BitNum that I want to use is from 0-12. Hope your all guy can help me or guide me to solve this problem. Appreciate your reply and thank you very much.

Cheers,
Furman
0 Kudos
Message 1 of 5
(2,595 Views)
Since you didn't get any answer, I suppose that I'm not the only one to have been deeply confused by your question. What means "bitnum" ? What's the purpose of your vi ?
Try to be slightly more explicit if you wish to get some help 😉

CC
Chilly Charly    (aka CC)

         E-List Master - Kudos glutton - Press the yellow button on the left...
        
0 Kudos
Message 2 of 5
(2,571 Views)
After being blinded by the colors on your diagram (It is very difficult to see a blue wire on a blue background and a green wire on a cyan background! :(), I think what you want to do is call the DBitOut with certain parameters whenever one of the booleans has been changed. The attached modification sketch shows one possibility (LabVIEW 7.1), but the details would need to be worked out once it becomes more clear what you actually want to do. (You probably would also need to initialize the shift register with the proper values).

Personally, I would stay away from the stacked sequence. It is completely unecessary because there is data dependency. Also bright colors have no use on the diagram, focus on the code first!
0 Kudos
Message 3 of 5
(2,569 Views)
Thanks for your help. And now I encounter a problem. After I click the button where the properties is changed to "Latch When Pressed", there is a error in the ErrMsg which shows "INVALID BITNUM SPECIFIED". How could I solve this problem? Appreciate your kindness and thank you very much.
0 Kudos
Message 4 of 5
(2,531 Views)
If you want this to work, you need to change your logic. Because the switch resets immediately, you'll always get true if you click the same button twice in a row. Since there is no change, the search array contains no TRUE and the output is -1. Converted to U32 it will be a very big number.

Once you set all booleans to latch action, it will no longer be possible to send a FALSE to the subVI. If you ONLY want to send true values, wire the array directly to the search array and eliminate the shift register and "equal" node. (However, now we have to ask ourselves why the subVI even needs a boolean input ;)).

IF you also need to send FALSE values, you cannot use latch action. It really depends on your hardware to decide what is appropriate, we cannot know these details.

(btw: you might also want to initialize the shift register with a boolean array corresponding to default values of all buttons.)
0 Kudos
Message 5 of 5
(2,518 Views)