LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to write data from daq card to serial port

attachment

Download All
0 Kudos
Message 11 of 15
(691 Views)

i posted a wrong picture of block diagram before...i am hereby attaching the correct one here.

0 Kudos
Message 12 of 15
(689 Views)

You can't send the data over the serial port like that. Please read the LabVIEW documentation. The waveform datatype isn't just an array of values. It's more like a cluster. It contains a start time, a delta time, and an array of values. You only want the array of values. Thus, you need to use the Get Waveform Components to get just the array of values. But then, you seem to be getting multiple channels from the DAQ read, but your picture implies you only want one. So, which is it? If you're just getting one channel, then you should use the DAQ function that gets one channel, not the one that gets you multiple channels and returns an array of waveforms.

 

Furthermore, the Flatten to String function will prepend the size of the array to the flattened string. Unless the other end is expecting this, then you also do not want this. Again, this is in the LabVIEW documentation for the Flatten to String function.

 

Furthermore, you should not have the serial port initialization and close inside the loop. Why initialize the port each and every time? Initialize and close outside the loop.

0 Kudos
Message 13 of 15
(687 Views)

hi

    yes, i need data from four channel. i was just trying to see whether i am getting data from one channel.

afte

 

0 Kudos
Message 14 of 15
(686 Views)

hi

 

 

              instead of daqmx i used a basic function generator from signal processing toolkit and connected to the serial port. then i got the waveform without any distortion...but when i am using daqmx some of the samples are getting lost as i have showed in the distorted picture above...what i understood is when visa serial port takes the control to write daqmx stop acquiring data from the data card until visa returns its control...but in the case of functiongenerator in the toolkit , when visa takes the control, function generator stops generating samples until the control is returned .this process repeats and so no loss of samples as in daqmx. this is what i felt. forgive me if i am wrong .

 

thanks and regards

0 Kudos
Message 15 of 15
(684 Views)