02-08-2012 07:05 AM - edited 02-08-2012 07:11 AM
Hello
I am using a NI-6132 for my research project. I use it under Linux with Python scripts wrapped around the C API for DAQmx. I have successfully programmed the card to output a signal (Manchester encoded baseband, so basically square waves with pulse width of 4.7us) based from its digital output port. I am attaching pieces of the code that I am using:
dsamplerate = 2500000.0
samplesize = 24
digital_output_str = r'Dev1/port0/line6'
dotask = nidaqmx.DigitalOutputTask()
dotask.create_channel(digital_output_str, name='line5')
dotask.configure_timing_sample_clock(source=r'ai/Sampleclock',active_edge='rising',rate=dsamplerate,sample_mode='finite',samples_per_channel)
dotask.write(ddata, auto_start=False, layout='group_by_channel')
raw_input("Press ENTER to start writting")
dotask.start()
The problem I am facing is that although the ouput is supposed to be digital (TTL), I get some distortion/ripple appearing at the begginning of my square pulses. The card will switch its ouput from 0V to 5V +- a certain ripple and then settle to how it should be. I am testing by connecting the output of my card to both an oscilloscope with 10MO impedance and the analog input of the card by doing simultanteous digital output and analog input. You can see the output on the scope in the attached image, shown in blue.Due to the time division in the particular image it shows as a spike, but if I lower it it would show as a ripple.
I don't think this is a sampling or sample size problem because I have tried with lower sampling rates and higher sample sizes and I still ge the same ripple. TTL at the end of the day should be high or low whether there are a million samples or just 1 sample.
My question is, looking at the card's spec sheet it says that I needs a bias of 50KOhm pu, with pu meaning pull-up. Do I need to use a pull-up resistor at the output of the card? Do I have to design a buffer ampliifer to match the digital output port of the card to the equipment I will be using? My intention is to connect the digital output of the card to an analogue modulator and mix it with a subcarrier coming from a signal generator (analogue signal). The impedance of the modulator is 50Ohms.
Thank you for looking at my question.
Solved! Go to Solution.
02-09-2012 06:05 AM
Hey Pourounas
The 50kOhm pu resistor means that this is included internally in the device and the device naturally wants to settle at Vcc on the output. The signal you output is a result of the device driving the voltage down to 0V instead of pulling it up to 5 Volts. TTL has tollerances built in to the specification of its signal so as long as that output is within these tollerences it is still a TTL signal. I cant tell where ground is on your image to be able to make this judgement.
http://en.wikipedia.org/wiki/Digital_signal#Logic_voltage_levels
Most digital signal generators experience this sort of spike when switching between states, although this is seems large. how are you connecting the device to the scope. could you be indusing this noise in that process?
The spec sheet does not specify an output impedance because it is relatively small and hence negligable. As a result any sort of input impedance greater than than 500Ohms would be reasonable so not something you need to worry about.
02-14-2012 06:53 AM
Hi Matthew
Thanks alot for your feedback. I am using two solid core wires, soldered onto a BNC connector. One cable is connected to Digital ground and the other to the digital line P0.6 and the other end to the scope. I only see the spike on the skope. When I capture that signal with the analogue input of the card the result is smooth, you can see that on the middle graph in the new image I am attaching. If I generate a TTL with the same frequency and votlage level with my function generator though the scope has no problem catching it without any spikes. It only has problems with the TTL the card is outputing but then again the analogue input of the card does not have any problems, with the same connection cable. I can only assume that there is some level of capacitance between the card and the scope, I have no other explanation as to why those spikes show up on the scope.
Thank you for your time.
02-15-2012 04:33 AM
I managed to sort things out with the card, it turns out there was some load mismatch with the scope after all. I tried with a 2-dB attenuator connected to my SMA cable and from there to the scope. The output has reduced to about 0.8V (from my maths I was expecting it to be 0.5V though) but the ripple is gone now. I am not 100% sure what kind of load that attenuator is as it was the first thing I found lying around in the lab so I am not sure if it is purely resistive or capacitive. I am going to try with a proper buffer amplifier circuit rather than the attenuator so I will have more control of what is actually going on.
I think there's something wrong with my oscilloscope because I get the same spike (ripple if I zoom in) with my function generator as well if I increase the signal amplitude over 1.5V.
One thing that still puzzles me though, when I was using P0.6 and P0.7 the high state of the the card's output was 5V. When I use the P0.2 line though the output is only 0.8V. I read in the spec sheet that the card can have two TTL high states, one being 5V and the other 0.8V. Are some of the lines pre-configured to use one or the other? Because I didn't change anything in my code(the variable that I am writting is either 1 or 0) just the hardware line.
Again, thank you Matthew.