LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Boolean data

Solved!
Go to solution

Hi all,

 

I have a NI DAQ usb 6009 device and hooked up a D-sub serial port (TxD line) in to one digital Input port.

What I want to do here is to read TxD and reconstruct the digital signal.

 

My problem is .. 

[dev / port0 ]

     0

     1

     0

     1

     1 

     1

    ....

 

I am getting one line binary signal (of course) and looks like this data array is not complete.

Meaning that if I change this signal to HEX, data doesn't have meaning at all.

Baud rate for the serial port is 9600. 

I am not sure 

1) if my sampling freq. isn't right.: it's like 10Hz fs.

2) is there anyway that I can receive data otherthan true, false but digital bit array? 

 

Can anybody help?

 

Thanks in advance,

 

-E Block Diagram

0 Kudos
Message 1 of 11
(3,711 Views)

If you only look at the TxD channel of a serial communication you have no clue where a byte starts. Did you try shifting the resulting U32 by 0-7 bits and convert to HEX (or ASCII) then?

Also, reading a U32 gives you 4 bytes, but by converting to U8 you skip 3 of them.

0 Kudos
Message 2 of 11
(3,703 Views)

 

Since I am not so familiar with labview yet, what I did was I generated a txt file and read in Matlab, 

Yes, and then changed to 0-7 bit by manually reconstructing as a matrix and changed to ASCII.

 

That's what I did and could not fine the array I needed.

 

Do you think the signal I got is complete? 

I still think txt file that's been generated is too short.. 

 

 

(*) Can you explain more detail about U32 -> U8 conversion????

 

 

Thanks,

-E

0 Kudos
Message 3 of 11
(3,700 Views)

You're right. You say the serial port is configured to 9600 baud. So your sampling rate should be 9600 Samples/s. But you might then have synchronization issues with the sender. In a serial protocol they are synchronized using other lines, if you only look at the TxD line this might be difficult.

And you also have to take into account the stop bits and other serial port configuration.

Why don't you just use a serial port to receive the data?

 

 

0 Kudos
Message 4 of 11
(3,690 Views)

@rororo wrote:

 

(*) Can you explain more detail about U32 -> U8 conversion???? 

 


Sorry, I see you configured the DAQ to read 1 sample at a time. So forget about that.

 

0 Kudos
Message 5 of 11
(3,686 Views)

I am looking in cause this signal is GPS signal and I am trying to get time signal to synchronize with my acceleration data. 

 

In your comment, can I ask what " Synchronization issue with the sender" means?

Is it possible to be fixed if I have other lines?

And I figured NI DAQ usb 6009 which I am using does not support the sampling rate as fast as to support 9600 data / s ..? 

 

 

Thanks a lot,

-E 

0 Kudos
Message 6 of 11
(3,685 Views)
Solution
Accepted by rororo

Serial communication also has other lines, see e.g. here for RS-232: http://en.wikipedia.org/wiki/Serial_port, in particular RTS and CTS lines to synchronize.

If it's not RS-232 but other serial communication (SDI) there are other lines like CLK, LOAD (or CS) that the master sends and the slave uses to synchronize.

 

If you can't read data at 9600 baud you'll have to find a way to lower the baud rate or use another device to receive it. But I would be surprised if the 6009 can't handle 9600 Samples/s. This might not work in single sample measurements like you've shown, you'll have to read multiple samples at a time.

 

 

0 Kudos
Message 7 of 11
(3,668 Views)

The 6009 will probably not acquire any faster than 1000 Sample/sec and it seems to be very unwise choice not to just read the data when connected to a serial port. There have been numerous examples posted on how to do this.

0 Kudos
Message 8 of 11
(3,653 Views)

Hello Dennis,

 

What do you mean by "just read data" when connected to a serial port ?

 

Meaning i can just read data from NI -DAQ? or read data by connecting serial port to a PC?

 

Thanks,

 

-E

0 Kudos
Message 9 of 11
(3,632 Views)
You just read from a serial port.
0 Kudos
Message 10 of 11
(3,623 Views)