Discussion:
digital output gives high pulse before going low when tristate set to false
(too old to reply)
nick_musson
2007-01-05 18:10:12 UTC
Permalink
i am using DAQmx from VB6 (CAPI)
i wish to use a digital output to be either tristate or low (using M or E series)

 
pseudo code to  go tristate (which works fine)
        DAQmxErrChk DAQmxCreateTask("", m_taskHandle)        DAQmxErrChk DAQmxCreateDOChan(m_taskHandle, m_DO_ports_in_spec(DO_index), "", DAQmx_Val_ChanForAllLines)        DAQmxErrChk DAQmxSetDOTristate(m_taskHandle, m_DO_ports_in_spec(DO_index), True)        DAQmxErrChk DAQmxStartTask(m_taskHandle)        DAQmxErrChk DAQmxWriteDigitalLines(m_taskHandle,1,True,10#, DAQmx_Val_GroupByChannel, 0,sampsPerChanWritten,ByVal 0&)        StopTask

pseudo code to  go tristate (which works fine but gives a 100usec 5V pulse before going low)
        DAQmxErrChk DAQmxCreateTask("", m_taskHandle)        DAQmxErrChk DAQmxCreateDOChan(m_taskHandle, m_DO_ports_in_spec(DO_index), "", DAQmx_Val_ChanForAllLines)        DAQmxErrChk DAQmxSetDOTristate(m_taskHandle, m_DO_ports_in_spec(DO_index), False)        DAQmxErrChk DAQmxStartTask(m_taskHandle)        DAQmxErrChk DAQmxWriteDigitalLines(m_taskHandle,1,True,10#, DAQmx_Val_GroupByChannel, 0,sampsPerChanWritten,ByVal 0&)        StopTask
note it is to be the DAQmxStartTask that takes the output high but if i remove the call it goes high when DAQmxWriteDigitalLines is called
MarkLe
2007-01-08 11:10:13 UTC
Permalink
Hi Nick,
Can you post what hardware (DAQ board) you are trying this on?
Regards,
Mark
NIUK & Ireland
nick_musson
2007-01-08 14:40:11 UTC
Permalink
I am developing on laptop with 6036E but target could be either 6703 or 6229
 
MarkLe
2007-01-09 13:10:09 UTC
Permalink
Hi Nick,
 
Thanks for the postings yesterday. I've tried emulating the pseudocode you sent using the same driver calls in LabVIEW, with both an M Series card (6221) and an E Series card (6040) and haven't managed to recreate the problem you're seeing as yet (I see the port going from low to tristate, but no 5V pulse in between, or straight after the DAQmx START). I should be able to get hold of a PCMCIA 6036 this afternoon, so will try again with that.
 
What have you currently got attached to the digital port? Do you just have an oscilloscope to monitor the line state, or any other hardware that may pull up the lines? What state are the digital lines left in before you run the code (ie could there be the possibility of another process still running when you start running the code?)
 
The two cards above have totally different tristating behaviours, making the testing a bit confusing (the 6221 has a weak pull down to Ground, and the 6040 has a pull-up!)
 
I'll let you know how I get on with the 6036.
 
Best wishes,
 
Mark
nick_musson
2007-01-09 15:10:10 UTC
Permalink
at present the line is pulled up to 3.3V through a 560 ohm resistor with 2.2kohm between the output and ground (ie in parrallel with the scope).
i just found something else that might help when i change the 3.3V to less than 2V i do not get a pulse
i do not think this is a hardware thing as the high length of the pulse seems to vary between 70 and 100 usec
MarkLe
2007-01-11 15:40:12 UTC
Permalink
Hi Nick,
 
I've managed to test this setup on my bench using a 6036E, and am still not seeing the same issue as you are unfortunately.
 
What I wanted to clarify was what you expect to see when the line is in 'tristate'. The way the resistors are setup, when the line is in tristate I would expect to see a voltage close to the supply voltage (on my setup it is 3.1V for a supply of 3.5V due to the potential divider effect)
 
So this means that when you send the pseudo code in the previous post (1st pseudo code), the line will go into tristate when you send the DAQmx Start, and stay there no matter what digital port writes are sent until you turn tristate off, at which time the channel will adopt the 'state' it is set into using the WriteLines command.
 
When you run the second pseudo code, the line will always follow whichever way it is set (as the tristate property is false), so in your case is probably defaulting to a high when START is sent, then is pulled low at some (short) time later with the Write digital lines command - hence a high pulse. I would cure this by sending a WriteDigitalLines command before the DAQmxStart, putting the line into the low state, then run the DAQmxStart.
 
As you have the Autostart boolean set to True on your WriteDigitalLines command, you do not have to send the DAQmx Start first, and this will avoid this period between the Start and WriteLines where the state is high. I gather from your earlier post thst you said the line went high if you left out the DAQmx Start and just used the WriteLines command - this sounds like incorrect behaviour. Do you see a high pulse before the line is pulled low?
 
Why are you particularly trying to use the tristate on the line? Is your goal to toggle between high and low voltage on the line? If so, you could just use the high and low states of the digital line rather than using the tristste. You should also be careful if you're going to migrate the code to other boards, as the tristate behaviour can vary between board (for example, the E series has a pull up behaviour in tristate, whereas the M series has a pull down resistor in tristate). 
Please let me know if any of this helps, or you still have problems. I would also recommend an upgrade to the latest version of DAQmx, 8.3 if possible - I have heard that there could be issues with tristate operations in DAQmx 8.
 
Best wishes,
 
Mark
nick_musson
2007-02-05 14:10:12 UTC
Permalink
thanks very much Mark  I will try DAQ 8.3
very useful info i had not considered the differences between M and E series boards
what i am trying to do is have a single output that is either hi, low or hi-impedance (ie another device can drive the line phycically connected to the output obviously, not at the same time though).
TheWay
2007-02-07 10:40:11 UTC
Permalink
Hi Nick,
Have you managed to solve the problem yet? 
Something you might want to try if you're just trying to drive a low after coming out of tristate is to write a 0 to the line with autostart set to FALSE, then start the task. This would ensure the line is immediately driven low when the task starts. So in your pseudo code, you'd rearrange the end of your code like this:
DAQmxErrChk DAQmxWriteDigitalLines(m_taskHandle,1,False, ..... )DAQmxErrChk DAQmxStartTask(m_taskHandle)
Let me know if you need any more help on this issue.
Regards
Way S.
NI UK Applications Engineer
nick_musson
2007-02-14 15:10:13 UTC
Permalink
it now works ok
i have to set the output state (hi or lo) before leaving tristate
i have added resistor to pull down when in tristate (for board compatibility) as other source can easily drive 2k ohms.
 
so problem now fixed
thank you 

Loading...