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

How to make a multiple pulse output?


  • Please log in to reply
13 replies to this topic

#1 LSlabjack

LSlabjack
  • Members
  • 13 posts

Posted 23 January 2008 - 09:06 AM

I am using single pulse output (no timer) as described by the example Vi "U3 Single Pulse Output (no-timer)" . How can I generate multiple pulses in the same way, with the pulse time counted by Labjack its self?

#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 23 January 2008 - 10:47 AM

If you want to do it the same way, that is not using a timer but rather using the IOType LJ_ioPUT_WAIT, then you need to look at how many commands you can fit in the low-level Feedback packet. The example does a LJ_ioPUT_DIGITAL_BIT to set the bit high, a LJ_ioPUT_WAIT for the delay, and a LJ_ioPUT_DIGITAL_BIT to set the bit low. From Section 5.2.5, the Feedback command has 7 bytes of overhead and room for 57 bytes of command data. Each put bit could take up to 4 bytes (2 bytes to set state and 2 bytes to set direction if needed). The wait IOType could take up to 4 bytes also (2 for short wait and 2 for long wait). That means the UD driver can fit at least 14 such commands in a single low-level Feedback packet. For example, you could do: LJ_ioPUT_DIGITAL_BIT (set high) LJ_ioPUT_WAIT (wait 100 ms) LJ_ioPUT_DIGITAL_BIT (set low) LJ_ioPUT_WAIT (wait 50 ms) LJ_ioPUT_DIGITAL_BIT (set high) LJ_ioPUT_WAIT (wait 100 ms) LJ_ioPUT_DIGITAL_BIT (set low) LJ_ioPUT_WAIT (wait 50 ms) LJ_ioPUT_DIGITAL_BIT (set high) LJ_ioPUT_WAIT (wait 100 ms) LJ_ioPUT_DIGITAL_BIT (set low) If you do too many commands, the UD driver will split them into multiple Feedback packets. That means there will be a delay (typically about 1 or 4 ms) between each 56 bytes worth of commands while a response is sent from the U3 to the UD driver and the UD driver then sends the next packet of commands. Usually, the Feedback wait IOType is the best way to do a single pulse or so, but with multiple pulses it is often better to use 2 timers as shown in the example "U3 ms Multiple Pulse Output.vi". The timer method is also better for creating smaller and/or more precise pulses.

#3 LSlabjack

LSlabjack
  • Members
  • 13 posts

Posted 23 January 2008 - 03:31 PM

The feedback is working on a single driver. What about using 2 drivers? How to output multiple pulses on different drivers at the same time?

#4 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 23 January 2008 - 03:34 PM

I don't understand what you mean by "driver". We use that term for software. Perhaps you mean "digital output" or "U3" ?

#5 LSlabjack

LSlabjack
  • Members
  • 13 posts

Posted 23 January 2008 - 04:01 PM

I mean 2 U3. I want synchonization of several DIO of these two.

I don't understand what you mean by "driver". We use that term for software. Perhaps you mean "digital output" or "U3" ?



#6 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 23 January 2008 - 04:43 PM

To do multiple devices, you just basically do a copy of what the example does currently. So you have another OpenLabJack call and pass that different handle to another AddS-Go-Get call. But I don't really see a way to get perfect synchronization. Perhaps describe what you are trying to do a little more. How many outputs do you need? How many pulses on each output? What sort of pulse widths? How good must the synchronization be between a pulse on 1 U3 and a pulse on another U3?

#7 LSlabjack

LSlabjack
  • Members
  • 13 posts

Posted 23 January 2008 - 07:09 PM

I have two U3 with extensions. All the output IO are connected to the relays, which control the LEDs. I used to have one LED turned on when taking the image. But now we need several patterns which require some certain LEDs on and off at the same time. We usually need about 10ms, so I think the synchronization should within 1ms.

#8 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 23 January 2008 - 09:40 PM

So how many LEDs on each U3? Maybe describe an example pattern that you are having trouble with.

#9 LSlabjack

LSlabjack
  • Members
  • 13 posts

Posted 24 January 2008 - 08:32 AM

Each U3 has used up all the 20 DIOs, either for LED or for other relays. Right now I only need several LEDs on the same U3 to work together. But latter I probably need more that connected to the other u3. I am using labview, there're some synchronization functions there, not sure how good these are.

#10 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 24 January 2008 - 10:48 AM

But I don't understand why sort of pattern you need? Do you have a complex pattern of various LEDs on and off at different times, or are all LEDs on and off at the same time? If all LEDs are on off at the same time, I would just use 1 digital output to control all of them. I think the best you can do for synchronization is about 1 ms. If you just issue the commands for different U3s right after each other, they will be perhaps 1 ms apart or so.

#11 LSlabjack

LSlabjack
  • Members
  • 13 posts

Posted 24 January 2008 - 01:22 PM

But I don't understand why sort of pattern you need? Do you have a complex pattern of various LEDs on and off at different times, or are all LEDs on and off at the same time? If all LEDs are on off at the same time, I would just use 1 digital output to control all of them.

I think the best you can do for synchronization is about 1 ms. If you just issue the commands for different U3s right after each other, they will be perhaps 1 ms apart or so.


Yes, I do need various LEDs on and off at different time. The circuit board we made is to controll each LED separately. The U3 is connected to each LED relay on that board. So I am trying to reprogram the way the LEDs are turned on and off without changing the circuit. I don't know if this make it clearer, but I think 1ms may be good to go. Thank you.

#12 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 25 January 2008 - 09:51 AM

OK. I would looking at using LJ_ioPUT_DIGITAL_PORT (see post #2 in this topic) rather than the bit command. That way you can update all outputs on a single U3 with a single IOType call.

#13 Susi

Susi
  • Members
  • 31 posts

Posted 14 September 2012 - 09:59 AM

hello, how can I used the LJ_iopout_wait in the DACO, I mean I need to send a voltage of 5 and the wait and send another voltagethat could be 5 or 0. I'm doing my on PWM to control a motor. so I have a vector with 0s and 5s that where taking with a period of time of 0.5ms. so I'll need to send the first value then wait 0.5ms and send the other one. I try with tic and toc in matlab but didn't work... Or maybe I'm doing somenthing wrong?? Should I used the FIO4 instead?

#14 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 14 September 2012 - 04:16 PM

Sounds like you want to use a Timer to produce PWM output, but if you do want to use the WAIT iotype the pseudocode in post #2 above gives you the idea. Try that and post a code snippet if you have trouble.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users