Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

LabWindows example & U3 = no DIOs


  • Please log in to reply
2 replies to this topic

#1 ElectroLund

ElectroLund
  • Members
  • 14 posts

Posted 17 October 2012 - 01:36 PM

My company uses LabWindows. I've got a U3. I'm no a 32-bit XP machine.

I've got the sample LabWindows software and I've commented out the stuff that doesn't pertain to my project. I'm simply trying to toggle a FIO pin as a sanity check.

Here's my code:

lngErrorcode = OpenLabJack (LJ_dtU3, LJ_ctUSB, "1", 1, &lngHandle);
if(lngErrorcode) goto ErrorMessage;

while (1)
{
	//Set digital output FIO2 to output-low.
	lngErrorcode = AddRequest (lngHandle, LJ_ioDIGITAL_BIT_OUT, 2, 0, 0, 0);
	if(lngErrorcode) goto ErrorMessage;

	//Set digital output FIO2 to output-high.
	lngErrorcode = AddRequest (lngHandle, LJ_ioDIGITAL_BIT_OUT, 2, 1, 0, 0);
	if(lngErrorcode) goto ErrorMessage;

	//Set digital output FIO2 to output-low.
	lngErrorcode = AddRequest (lngHandle, LJ_ioDIGITAL_BIT_OUT, 2, 0, 0, 0);
	if(lngErrorcode) goto ErrorMessage;

	//Set digital output FIO1 to output-low.
	lngErrorcode = AddRequest (lngHandle, LJ_ioDIGITAL_BIT_OUT, 1, 0, 0, 0);
	if(lngErrorcode) goto ErrorMessage;

	lngErrorcode = AddRequest (lngHandle, LJ_ioDIGITAL_BIT_OUT, 1, 1, 0, 0);
	if(lngErrorcode) goto ErrorMessage;
}

I made certain first with the LJControlPanel that the FIOs were set to output. But both output bits 0 & 1 stay at 3.3V. I see no errors when I make the project. I can step through each line, but no output. It's gotta be something stupid that I'm doing wrong, right?
This has to be something easy

#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 17 October 2012 - 01:55 PM

Did the example work before you made any changes?

I don't see a Go() or GoOne()?

http://labjack.com/s...users-guide/4.1

Perhaps rather than an Add/Go/Get block, you just want to use ePut/eGet, or easier yet just use eDO?

http://labjack.com/s...ers-guide/4.3.9

Also, the iotype LJ_ioDIGITAL_BIT_OUT is long ago depreciated, although it likely still works. I suggest you use LJ_ioPUT_DIGITAL_BIT instead:

http://labjack.com/s...ers-guide/4.3.5

We don't get much activity in LabWindows, so that would explain why an old iotype would show up in an example.

#3 ElectroLund

ElectroLund
  • Members
  • 14 posts

Posted 22 October 2012 - 08:15 AM

I don't see a Go() or GoOne()?

Sorry, I didn't include that line in my OP. What I wasn't realizing is that each bit output requires its own Add/Go cycle. I just RTFM and it works fine now.

Perhaps rather than an Add/Go/Get block, you just want to use ePut/eGet, or easier yet just use eDO?

Ooo, I much prefer the eDO/eDI!

Also, the iotype LJ_ioDIGITAL_BIT_OUT is long ago depreciated, although it likely still works. I suggest you use LJ_ioPUT_DIGITAL_BIT instead:

Roger that. Thanks!


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users