Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Read Binary File To LABVIEW Matrix

Hi,
 
I have created a binary file in MATLAB with 'schar' format which can be read in c.
I would like to read the data to LABVIEW MATRIX for generating pattern output using
PCI 6534 device and external clock as trigger.
 
Please explain how to read the file to LABVIEW.
 
Thanks.
0 Kudos
Message 1 of 14
(5,558 Views)
Hi,
 
Well you need to know how Matlab is storing the data. After that everything should be fairly easy. Use the File I/O VIs to open the file, read the data, and then close the file. Remember to specify the data type (byte stream type) on the Read File VI. If you can't get that to work, post some very simple example code for generating an schar array in Matlab and an example of the type of file you would like to read.
 
Regards,
Chris J
0 Kudos
Message 2 of 14
(5,550 Views)

Hi Chris,

I decided to read the data from *txt file to LABVIEW variable. (After loading I will write the data to DIO in real time periodically).

I would like to write data burst to a device using PCI 6534 , I added my application.

1.      Is it preferred to use pattern IQ generation or burst transfer mode?

2.      Can you send me an example which is related to this application.

 

Best Regards,

Nir

0 Kudos
Message 3 of 14
(5,545 Views)
Hi,
 
I recommend using Pattern IO for your application.  I am attaching an example which should help get you started.  The example will read data from a binary file and output this data on digital lines for the 653x series boards. I hope you find the example helpful. 
 
Regards,
Hal L.
0 Kudos
Message 4 of 14
(5,533 Views)

Hi,

In my application the write should be triggered with external clk (84 kHz) and in sync with external clk 4.2 MHz signal.

Upon each trigger clk the PCI should write one 50 bits data burst, which are in sync with the external 4.2 MHz clk.

Is is possible with Pattern I/O?

(Your application uses internal port)

Can you update the above *.vi for the requested system?

Best Regards,

Nir

0 Kudos
Message 5 of 14
(5,526 Views)

Hi,

I want to make sure that I am clear on what you are trying to do.  Are you trying to output 50 bit bursts at a rate of 4.2MHz at every edge of an 84 kHz external clock?  Please let me know if this is your application. 

Regards,

Hal L.

0 Kudos
Message 6 of 14
(5,496 Views)
Hi,
 
My application is SSI Out. (Serial Sync. Interface , "Write").
I have 3 digital lines.
1. CLK - 4.2 MHz  (Is given From External Device)
2. SYNC - 84 kHz (Is given From External Device) 
3. Data - Generated form file. (Is loaded from file *.txt to LABVIEW variable)
 
Upon each SYNC burst of 50 bits should be transfered (On Data line) from PCI 6534 to an external device.
The CLK is for synchronizing the data.
 
Is "Parallel output with external triggering" is suitable?
1. The CLK form the external device is connected to REQ line.
2. The SYNC serves as burst trigger, and connected to ACK1 (STARTTRIG1) line.
 
Best Regards,
Nir 
0 Kudos
Message 7 of 14
(5,491 Views)

Hi,

Using parallel mode along with retriggered finite digital output will work for your application.  I am attaching another example which should help get you started with this.  You should be able to take this example and make the necessary modifications to fit your specific application.  I hope that you find it helpful.

Regards,

Hal L.

0 Kudos
Message 8 of 14
(5,476 Views)

Hi,

I am still trying to write my data using external CLK and CLK trigger.

I had real time problems, (I need that every trigger, different sample will be written).

I changed my VI to the added one.

And I am getting the following error:

Error -200462 occurred at DAQmx Start Task.vi

Possible reason(s):
Generation cannot be started, because the output buffer is empty. 
Before starting a buffered generation, write data. Unreserving a task empties the buffer. Changing the size of the buffer or setting the Regeneration Mode property will result in the buffer being unreserved and emptied.
 
What can be done?
 
Best Regards,
Nir
 
0 Kudos
Message 9 of 14
(5,438 Views)

Hi Nir,

I took a look at your code and you need to make a couple of modifications to eliminate this error.  First, you need to insert a new DAQmx Write before the while loop.  Also, move the DAQmx Start Task to just after that new DAQmx Write and move it outside the while loop.  You also need to move your DAQmx Stop Task vi after the while loop so you don't start and stop your task at every iteration of the while loop.  This will make your program run more efficiently.

Regards,

Hal L.

0 Kudos
Message 10 of 14
(5,413 Views)