Rob Clark Posted February 14 Share Posted February 14 The following code attempts to output a ramp on a USB-231 or USB-234. At times the ramp occurs... other times, there is no output from the AO channel This is VB6 on Windows 10 using CBW32.DLL ver 6.73 lngStatus = cbDeclareRevision(CURRENTREVNUM) lngStatus = cbErrHandling(DONTPRINT, DONTSTOP) ' intWaveformArray >> array of voltages from 0 to 2 back to 0 converted to integer mccdevice.intBoardNum=0 mccdevice.intChannel=0 lngDownPoints=1000 lngCBRate=56 mccdevice.intRange=1 mccdevice.lngMemoryAddress = cbWinBufAlloc(lngDownPoints) lngFirstPoint = 0 lngStatus = cbWinArrayToBuf(intWaveformArray(0), _ mccdevice.lngMemoryAddress, lngFirstPoint, lngDownPoints) lngStatus = cbStopBackground(mccdevice.intBoardNum, AOFUNCTION) ' force to background so code can continue intOptions = BACKGROUND ' trigger the waveform output lngStatus = cbAOutScan(mccdevice.intBoardNum, mccdevice.intChannel, mccdevice.intChannel, _ lngDownPoints, lngCBRate, mccdevice.intRange, mccdevice.lngMemoryAddress, intOptions) Sometimes, restarting program the sequence will work fine. This occurs on both a USB-231 and USB-234. All statuses result in no errors but a voltage output does not occur. This module is ONLY used for AO, no other functions are used. As an aside, this code works fine with a PCI board. Link to comment Share on other sites More sharing options...
0 DAQman Posted February 14 Share Posted February 14 Please see our ULAO04 example in \Public\Documents\Measurement Computing\DAQ\VBWIN\. It outputs a continuous square wave. I can't run the VB6 version because VB6 is too old and not supported on Windows 10 or 11. I ran the same example in VB.NET form and did not experience a program starting the waveform on a USB-231. Link to comment Share on other sites More sharing options...
0 Rob Clark Posted February 15 Author Share Posted February 15 I used the example as my starting point -- as I said it works sometime and not others Link to comment Share on other sites More sharing options...
0 DAQman Posted February 15 Share Posted February 15 You could use our DAQami program to test the device. Enable an analog output channel and place it on an Output display window. Right-mouse click the slider control, and for Signal Type, select Waveform. How long have you owned these devices, and which version of Windows are you using? Link to comment Share on other sites More sharing options...
0 Rob Clark Posted February 15 Author Share Posted February 15 (edited) Under a year , maybe 6 months on one It's Windows 10 -- I put traces on all the data - driver reports all OK I now do a cbStatus while waiting for the ramp completion. On good ramps, status reports 0. On no ramps, fairly quickly error 78 (underrun) is reported. What causes this and is there a way to get around it? Edited February 15 by Rob Clark Link to comment Share on other sites More sharing options...
0 DAQman Posted February 15 Share Posted February 15 An underrun condition means the driver is being prevented from updating the 231. A similar condition on the input side is overrun. The waveform is stored in the USB driver's memory, not on the device. An interrupt occurs continuously once the cbAOutScan is called, telling the driver it needs more data until cbStopBackground. An underrun condition happens when the USB driver does not handle the interrupt, which can occur if a Windows Process hogs the system. Perhaps a security scan. What is interesting is it should happen with the DAQami software, too. If it doesn't, then I'm not sure what it is. I ruled out a hardware issue because you have two devices doing it. See if you can rule out the PC by trying another. Link to comment Share on other sites More sharing options...
0 Rob Clark Posted February 15 Author Share Posted February 15 This PC is a business computer that requires a company program load like CrowdStrike and all other kinds of nonsense so god knows what is going on in the background. Do you have another USB device that is not so dependent on a perfect world? It wouldn't take much memory on board a USB device to do most AO. My alternative right now is to ditch the Digilent stuff and find a waveform generator. Link to comment Share on other sites More sharing options...
0 DAQman Posted February 15 Share Posted February 15 All the MCC devices that have analog output work the same way. None of them have onboard memory for the waveform. It was one of the ways we kept our costs low. Link to comment Share on other sites More sharing options...
Question
Rob Clark
The following code attempts to output a ramp on a USB-231 or USB-234.
At times the ramp occurs... other times, there is no output from the AO channel
This is VB6 on Windows 10 using CBW32.DLL ver 6.73
lngStatus = cbDeclareRevision(CURRENTREVNUM)
lngStatus = cbErrHandling(DONTPRINT, DONTSTOP)
' intWaveformArray >> array of voltages from 0 to 2 back to 0 converted to integer
mccdevice.intBoardNum=0
mccdevice.intChannel=0
lngDownPoints=1000
lngCBRate=56
mccdevice.intRange=1
mccdevice.lngMemoryAddress = cbWinBufAlloc(lngDownPoints)
lngFirstPoint = 0
lngStatus = cbWinArrayToBuf(intWaveformArray(0), _
mccdevice.lngMemoryAddress, lngFirstPoint, lngDownPoints)
lngStatus = cbStopBackground(mccdevice.intBoardNum, AOFUNCTION)
' force to background so code can continue
intOptions = BACKGROUND
' trigger the waveform output
lngStatus = cbAOutScan(mccdevice.intBoardNum, mccdevice.intChannel, mccdevice.intChannel, _
lngDownPoints, lngCBRate, mccdevice.intRange, mccdevice.lngMemoryAddress, intOptions)
Sometimes, restarting program the sequence will work fine. This occurs on both a USB-231 and USB-234.
All statuses result in no errors but a voltage output does not occur. This module is ONLY used for AO, no
other functions are used.
As an aside, this code works fine with a PCI board.
Link to comment
Share on other sites
7 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now