Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Digital input data

Hi All,

 

My querry is relating to how I can improve digital input task in my application.

 

Problem:

 

I have a sensor that outputs serial stream on 1 and 0. Currently what I am doing is that I am oversampling the input and then in software I run a loop on the received data to convert it to 1 and 0's. for example reviced data is 11110000000011111111....and I change it to 10011 (Hope you get the point).

 

But what I am interested to do is that instead that I get this whole over sampled data I want that i jsut get the 10011 from the card instead of a whole array of data that I change later.

 

and I am not sure how can I do it with NI Daq cards. Maybe counters or timmers or even if there is a way to do this via the DAQ ?

 

Thanks

0 Kudos
Message 1 of 6
(4,373 Views)

Is there a sample clock coming from somewhere?  That will be the real key to decoding a digital stream.  You have to know when to look.

 

Also, what DAQ card are you using?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 6
(4,369 Views)

Hi ,

 

so currently I am using PXie-6535 DIO card. The I know the clk freq of the incoming signal. I start receving the data based on triger that is send as soon as the sensor is activated. So in short my card start looking (sampling) the data much before the actual data is send.

 

do you have an example with a sample clk ? may it will give me a better idea to decode the digital stream instead of sending the huge amount of data into a loop.

0 Kudos
Message 3 of 6
(4,366 Views)

AliA15 wrote:

do you have an example with a sample clk ? may it will give me a better idea to decode the digital stream instead of sending the huge amount of data into a loop.


I'm assuming you are using LabVIEW here.  You can use the DAQmx Timing VI to set up your task to read the digital samples at a given rate.  You can also use that function to tell the card to take samples on an input clock.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 6
(4,359 Views)

Hi,

 

if you know the sample frequency, the easiest thing to do is to set the "same" frequency as the internal sample clock.

But you would have to know that your clock wouldnt have the exact same speed as the source, so after some time your acquired signal would drift. So it is not a perfect solution.

Normally you should use the external clock signal so you dont experience drift. So if you sample your signal with that external clock signal you would still get "11110000000011111111" (from your example) and not the desired reduced signal "10011".

For that you would have to scale down the signal of the external clock signal and feed in one of the listed line (see page 5 of the specifications):

 

1.   On Board Clock (Sample Clock Timebase with divider)
2.   PFI <4..5>
3.   PXI_TRIG7 (PXI backplane)
4.   PXI_STAR (PXI backplane)
5.   PXIe_DSTARA (PXI backplane)

NI PXIe/PCIe-6535/6536/6537 and NI PCIe-6535B/6536B/6537B Specifications
http://www.ni.com/pdf/manuals/374373g.pdf

 

How do you scale down the signal from lets say 4 MHz to 1 Mhz? Either externally or you would need a counter (e.g. from another multifunction DAQmx card) that could divide the clock down to the desired value and route that to a source the PXIe-6535 can utilize as a sample clock.

 

Community: Divide External Clock by Two Using Counter in DAQmx
https://decibel.ni.com/content/docs/DOC-12912

 

Best regards,

Christoph

Staff Applications Engineer
National Instruments
Certified LabVIEW Developer (CLD), Certified LabVIEW Embedded Systems Developer (CLED)


Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved
Message 5 of 6
(4,316 Views)

Thanks I think it would work. Let me try that. Then I mark it as solution 🙂

0 Kudos
Message 6 of 6
(4,302 Views)