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

Keep U12 state when restarting program


  • Please log in to reply
5 replies to this topic

#1 hakelm

hakelm
  • Members
  • 9 posts

Posted 27 February 2015 - 04:39 AM

I have a U12 that I control with a Python program. When I restart the program and reconnect to the U12 all the U12 settings i.e. analog and digital outputs are forgotten and set to their default values (0). In order to have a glitch-free operation my program must be running all the time and I can't use it as for instance a cron-job.

Is there any way to reconnect without changing the state of the U12 I/O?

H

 



#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 27 February 2015 - 09:53 AM

So when you first start your program, you would like it to know the current condition of the U12, rather than starting from some defaults you define in your software.  The only way your software could possibly know the current condition of the U12 is to read the current condition of the U12 at startup.  Or did you have something else in mind?

 

I assume you are talking about outputs, or lines than can be outputs (DIO)?  If you call DigitalIO with updateDigital=FALSE, you can read the the direction and output registers of the D lines.  For the IO lines all you can do is get a current read of their state.

 

There is no way to read the current specified output voltage of the analog outputs (AOx).  The best you can do is jumper these to analog inputs and read those.

 

Note that our other devices (all of which are newer than the U12) are more capable in this regard ... especially our newest device the T7.



#3 hakelm

hakelm
  • Members
  • 9 posts

Posted 28 February 2015 - 06:00 AM

Thanks.

I am sorry if I was a bit unclear. I don't need to know the current condition of the U12, I want it to keep the current condition.

If I for example set a digital out pin to 1 and terminate the program the IO-bit remains set to one.

When the program is restarted and reconnects to the U12 the IO-bit is reset to zero so even if the program immediately sets the bit to one I have a glitch i.e. a one to zero to one transition.

Is there any way to avoid this glitch?

H



#4 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 02 March 2015 - 11:02 AM

Are you using EDigitalOut?  Note the following from Section 4.5:

 

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

 

Note that this is a simplified version of the lower level function DigitalIO, which operates on all 20 digital lines. The DLL (ljackuw) attempts to keep track of the current direction and output state of all lines, so that this easy function can operate on a single line without changing the others. When the DLL is first loaded, though, it does not know the direction and state of the lines and assumes all directions are input and output states are low.

 

 

This is a limitation of the U12 and the U12 driver.  Our other devices and their libraries are better at handling this.  What you can do, is at the beginning of your program make a call to DigitalIO to read the current condition of the lines (as much as possible from post #2 here), then make a call to DigitalIO to write those same conditions (updateDigital=TRUE), and the driver should then know them and a call to EDigitalOut on 1 bit will not affect other bits.



#5 hakelm

hakelm
  • Members
  • 9 posts

Posted 03 March 2015 - 12:37 PM

Thanks,

I unerstand I will have to accept a brief glitch.

H



#6 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 03 March 2015 - 03:35 PM

I would not expect a glitch from what I described in post #4.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users