Hi,
In my code I am reading Analog Values (FIO 0-7,EIO 0-6) total of 15 values (using U3-HV OEM), and they all work fine. But when I try to write '0' to the digital port CIO 0, its not working. Do we have to intialize digital ports before using them? Are the digital ports (CIO 0) defaulted to high when U3 device powers up. I have attached a snapshot of code. Kindly advice.
What you have looks correct to set CIO0 low. The DIO are set to digital input for the factory startup defaults. The digital inputs are held high by a weak pullup resistor to 3.3V.
How are you checking the CIO0 state? One thing to note is that using LJ_ioGET_DIGITAL_BIT will automatically set the IO to input, and if there is not some signal holding the line low the pullup will cause the IO to read high.
That's right and that's why I am not using LJ_ioGET_DIGITAL_BIT anywhere. Instead I am using LJ_ioPUT_DIGITAL_BIT to set the CIO-0 as output. Thats correct, right?
Also, as shown in snapshop, I am using LJ_ioPUT_DIGITAL_BIT in the AddRequest. So, 1) Do I need to use the LJ_ioPUT_DIGITAL_BIT before the AddRequest to assign CIO-0 as input port. 2) When I write AddRequest (as shown in snapshot), is it okay if I don't write a GetResult command after the GoOne command.
Hi, Actually I did find something. Whenever I set CIO-0 'high' using command
"lngErrorcode = eDO(lngHandle1,16,1)"
the phyiscal CIO-0 port measures 3.3V on DMM.
But when I set it 'low' using same command
"lngErrorcode = eDO(lngHandle1,16,0)"
the phyiscal CIO-0 port measures 2.0V.
Do you know why that might be happening? Why would CIO-0 meaures 2.0V when it has been set to 0V.
Yes, that is correct.
I am not sure I understand this. If you mean the analog enable setup, that should not effect the CIO. The CIO cannot be configured as analog.
The GetResult call from a 'Put' (write) request will only return an error code. As such the GetResult call is not necessary, but we do recommend including it to assess the error return.
It is hard to say for certain what is going on. That you are only seeing the problem on the CIO could indicate a wiring issue. I would recommend doing some more simple tests to try to isolate the issue. You could start by removing all external connections to the U3 besides the USB and DB15 expansion board. If you are on Windows I would recommend testing in LJControlPanel. Using a short wire, connect CIO0 to another IO set to input then toggle CIO0 and monitor the input DIO. You should see the input DIO state changing based on the CIO0 state you set. If that seems okay, you could add back in your hardware. If you want to do a DMM measurement, I would recommend first disconnecting anything ot CIO0 and probe between CIO0 and GND, ensuring you have good electrical connections:
https://labjack.com/support/app-notes/screw-terminals