Looking for a simple high-level method of latching an output channel | LabJack
 
Friday May 29th 2020
Support: LabJack engineers available through email and chat.
Shipping: We are processing and shipping all orders.
Stock: 51 of 56 products are in stock. More details.
Supply Chain: Minor impacts. More details.

Looking for a simple high-level method of latching an output channel

5 posts / 0 new
Last post
labjacknoob
j.nute's picture
Looking for a simple high-level method of latching an output channel

Hi,

I'm trying to write a simple square wave to an FIO channel. My current approach uses the LabView_LJUD VIs eAddGoGet or sAddGoGet to write the data to the channel and for loops and waits to shape the waveform. However, when I run a monitoring loop in parallel (using the same AddGoGet  VIs to read) I can see that the LabJack isn't latching and so my signal looks like a comb. 

I am aware of the low-level commands wait and waitlong, but I can't help feeling that there must be a simpler way to achieve this...

Thanks in advance!

Jon

File Attachment: 
LabJack Support
LabJack Support's picture
If you tell a DIO to go to

If you tell a DIO to go to some particular state, it will stay at that state until something else tells it different or reboot.  My best guess is that your monitoring loop is changing the state.

Does your control loop toggle the line between output-high and output-low, or toggle it between the input state and some output state?

What are you reading in your monitoring loop?

labjacknoob
j.nute's picture
Thanks for the reply.That's a

Thanks for the reply.

That's a relief! I did have a sneaky suspicion that could be the case. It toggles the line FIO3 between high and low, it's the bottom boolean in the cluster shown in squarewave.jpg. 

I have physically connected FIO3 to AIN0 with a jumper wire and I'm reading AIN0 with my monitoring loop. I've attached a few more images to better illustrate what is going on. 

The sub VIs LJ Write and LJ Read are just chopped up versions of the LabJack example VI "U6 Multiple IO Example eAddGoGet". 

Thanks again. :)

LabJack Support
LabJack Support's picture
If you were reading FIO3,

If you were reading FIO3, with the wrong iotype (LJ_ioGET_DIGITAL_BIT or LJ_ioGET_DIGITAL_PORT both set the line or lines to input), that would cause problems but I don't see that you are doing that.

Is the comb you are seeing mostly high or mostly low?

Do you have an oscilloscope you can use so you can just toggle the line without doing any reads and see if that works?  Or if you go slow enough a DMM would work fine to see the voltage on FIO3.

Keep in mind it can be tough to tell whether a line is set to input or output-high, as an input has a 100k pull-up to 3.3 volts.

1.  Look for a slight change.  On my U3-HV with nothing connected except DMM I see 3.353 for input and 3.367 for output-high.

2.  Add a load resistor.  If you add a 100k from FIO7 to GND, it should read about 1.6V for input and 3.3V for output-high.

labjacknoob
j.nute's picture
Sorry for the slow reply. I

Sorry for the slow reply. I've been working on other parts of my labview program. I haven't managed to test the program & labjack thoroughly with an oscilloscope, but I have tried it with the piece of hardware it was intended for and the program worked as expected/intended. This is enough evidence for me to conclude that the labjack outputs correctly when it is not measured by LJ Read. Since I have the functionality I need right now, I won't be pursuing this issue any further. However, I may be back in the future to get to the bottom of this.

Thanks for your help.