LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Interrupt usb write buffer: how to write 8 bytes as string

Solved!
Go to solution
Hi! I am using USB RAW: Interrupt method to read and write 8 bytes data each time. However, I am having trouble writing 8 bytes into buffer...I want to write such a way that I have a control of all 64 bits(8 bytes) from front panel...I have tried method shown in figure below...but my 8 bytes became 8 bits effectively...how can I make 8 group of 8 bits so it transfers 8 bytes effectively??
Download All
0 Kudos
Message 1 of 13
(4,015 Views)

Hi number,

 

have you tried something like this:

bits2bytes.png

(The InitArray-function is only to define the size of the array. Change the "Array" indicator to become a control, showing 8x8 boolean switches...)

 

Why do you assume 8 bytes become effectivly 8 bits?

How big is your boolean array (it's not included in your vi)?

Message Edited by GerdW on 11-23-2009 09:04 AM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 13
(4,003 Views)

Hi!!

 

I have attached the vi. Can you implement your idea on that vi?

 

I am trying though...now about 8 bytes to b bits... see at other side ,I have 8 bytes waiting to read write buffer, but when I used as shown in vi , all 8 bits(boolean)  are read as 8 different bytes instead of one single byte in my program.

 

So I want to access 64 bits that can be read as 8 different bytes..

0 Kudos
Message 3 of 13
(3,999 Views)
sorry ! attached vi.
0 Kudos
Message 4 of 13
(3,997 Views)

Hi number,

 

your array contains 19 bits! This is your coding:

yourway.png

Those 19 bits are converted to zeros or ones, so you get a numeric I16 array containing 19 numbers (0 or 1). This is then converted to an array of string, each string containing either "0" or "1". Then you append all strings of the array to one string (resulting in "0111000000000100001").

 

To receive 8 bytes you need 64 bits, best would be 8 times 8 bits. Do as shown in my first message...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 13
(3,993 Views)
I am trying but I am unable do 3 rd step in your figure, can you post vi?
0 Kudos
Message 6 of 13
(3,987 Views)
Solution
Accepted by 26314362

Hi "1100100011000011001111010",

 

what is the 3rd step you can't do?

 

Anyway, see attchment...

Message Edited by GerdW on 11-23-2009 09:50 AM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 13
(3,985 Views)

To, GerdW 

 

great man it works.

 

Now, how to seperate out 8 (64 bits---part into 8 groups)different controls bytes for 1-D array.. right now it is in one line...I want to fragment it so it can be more user friendly...

 

MS.

0 Kudos
Message 8 of 13
(3,979 Views)

Hi,

 

use a 2d array Smiley Wink

 

Or:

Show 8 bits of the 1d array and hide the array index. Make a second numeric control to let the user select the byte. Set the array index using property nodes to multiples of 8 to always show "full" bytes.

Message Edited by GerdW on 11-23-2009 10:20 AM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 13
(3,977 Views)

To GerdW,

  Thats ok, but can it be possible to make some of the values (say 32 bits of 64) to be enter from front panel and other values to be conditional that depends on the logic during program...so it depends on the other values...so I wanted to put a variables sized 1 byte so it can be modifeid during program run...how to use variables for this configuration...

 

Thanks..

MS

0 Kudos
Message 10 of 13
(3,973 Views)