AzeoTech

Administrators
  • Content Count

    5,672
  • Joined

  • Last visited

Everything posted by AzeoTech

  1. AzeoTech

    button to start logging

    Actually, I was wrong. You can name the logging set log even though it is a reserve word. You would not want to create a variable or channel named "log" however. So, the docs are actually correct.
  2. AzeoTech

    button to start logging

    Do you have that if in a loop? Otherwise it will execute only once and unless you have the button pressed at that time, nothing will happen. Actually, when you want to do something based on channel value, you probably should use a channel event. Click on the FIO0 channel in the workspace under CHANNELS: and then select the event tab on the right. You can put code here that executes whenever FIO0 is read (except stream, in which case it is in blocks). There you should be able to put your exact code. Also, I just noticed: you can't call your logging set "log" because log is a reserved word for the function log() which performs the logarithm of a value. You should pick a different name.
  3. AzeoTech

    simple if

    You need to use two equal signs to do comparison: if (switch[0] == 1) a single = is assignment
  4. AzeoTech

    parallel traces in a graph

    How are you clearing the one trace? Using ClearHistory() I assume. Well if your _cal traces are just variables, they should still remain when you clear the history of the regular channels unless you have some sort of autoscaling. Perhaps you can email back and attach your document so we can tell what you have done.
  5. No, not quite. Anytime you create a group of channels with different Timing / Offset parameters, they run in a different thread. These threads are synced in time, but the averaging point (i.e. where in the second it decides to take 10 points) is pretty much determined by when the document is loaded and is not predictable. I'd bet if you quit and restarted it would land on a different time than the 0.7 point in the second. You have a couple choices: 1) Unless you have a reason not to, I would just sample all the channels at 10hz and average them all. With the UE9 you are well within the bandwidth, so the only reason why not would be if you need an instantaneous reading every second instead of the average 2) You can sync up the average with the 1 second reads using an event in one of the 1 second channels and a new averaged channel. To do this: a) create a new channel, lets say you call it datafinal. Make it just like your raw 10 hz channel, but give it a channel number in the thousands (one that doesn't really exist) and set the Timing to 0. This is the channel you will want to log instead of the raw 10 hz Turn averaging off on the 10hz channel and set the history to something small like 20. c) in the event for one of 1 second channels put: private average = mean(rawdata[0,9]) average.time[0] = mychannel.time[0] datafinal.AddValue(average) The first line calcs the average of our 10hz data (which I assumed you called rawdata). By doing [0,9] you are taking the mean of the last 10 data points. The next line simply injects the time of this channel into our average so it lines up. I'm assuming your 1 hz channel that holds this event is called mychannel. The final line takes that data and injects it into the datafinal channel. Now this channel will hold the 10 point average of 10 hz data lined up to mychannel. The average is calced every time mychannel gets a new value.
  6. Yes you can certainly stream the UE9 over Ethernet. In fact, it is slightly faster over Ethernet. As to your problem, I would first make sure you can communicate with the device at all by simply polling the device once a second instead of streaming. If you get that and the stream still doesn't work, please email your document and any error messages. Also, one thing that comes to mind: did you remember to change the D# on the channels that receive the data? This must match the D# you assigned your UE9 too. As for your logging problem, if you are looking to simply log once a second snapshots, you might want to use an export set instead and then use a sequence to trigger it. The export set would have [0] in all the expressions to log only the most recent value, then the sequence would simply start the export set once a minute: while (1) beginexport(myexport) delay(1) endwhile The big advantage of this method is that you can start and stop at will, and you can easily switch it to event driven logging, where the logging set is really designed for continuous logging.
  7. AzeoTech

    2 counters on UE9

    OK, first you probably should avoid using D# 0. D# 0 was provided mostly for people used to using the U12, but with the addition of first found in the device configuration, you should avoid it. The reason is that if you get another UE9 or U3 (and so are using 2 labjack devices on the same PC) you'll can't use D# 0 at all and so you'd have to go back through your code and change every instance. If, instead, you had used first found in device configuration with a D# of 1 say, then all you'd have to do is replace this listing with an actual ID number, and all your instances / code would update. Now, as to your question, the problem is simply that you didn't enable both counters in your ResetCounters sequence (which, by the way, is misnamed, as the code inside only enables the counters and doesn't reset them). The code you want is: device.LabJack.AddRequest(0,"LJ_ioPUT_COUNTER_ENABLE",0,1,0,0) device.LabJack.AddRequest(0,"LJ_ioPUT_COUNTER_ENABLE",1,1,0,0) device.Labjack.GoOne(0) Alternatively, if you use the device configuration instead of D#0 you can enable the counters from there without any code.
  8. AzeoTech

    graph control with edit box or button

    I'm not sure I understand your question. If you are using a button, you'd just go to the Action page, select Quick Sequence and type in the code like: Component.MyGraph.MyTrace.strYExpression = "V.Motor5" Create a different button for each possible trace, changing the code appropriately.
  9. AzeoTech

    add page

    If you wish additional pages, you can purchase DAQFactory Lite for $199 from www.azeotech.com. This will give you unlimited pages, 30 or so more screen components (like guages, sliders, knobs, etc) and support for devices other than LabJack. Your Express document will work without change in Lite or any other version of DAQFactory, so the upgrade is very easy.
  10. AzeoTech

    U12 stop logging at a defined time

    No problem. Assuming your logset is called MyLogSet: beginlogging(mylogset) wait(900) endlogging(mylogset) This simply starts the logging when the sequence starts, then the sequences waits 900 seconds (15 minutes), and then it stops the logging set. Then just create a button to start this sequence. Note that stopping this sequence early won't stop the logging set, so if you want to be able to manually stop early, use the Quick Sequence action of the button instead of Start/Stop sequence and put something like this (assuming the above sequence is named MySeq: if (Sequence.MySeq.Running) endseq(MySeq) endlogging(mylogset) else beginseq(MySeq) endif Basically it looks to see if the sequence is running and if it is, it stops both the sequence and the logging set, otherwise it simply starts the sequence.
  11. Sure, just use a variable. Declare it somewhere (say auto-start sequence:) global timecounter Then when you want the time to start do: timecounter = systime() and wherever it is displayed, put: SysTime() - timecounter Use formattime() to display in H:m:s: formattime(systime()- timecounter) or formatdatetime() if you want more control over the display. If you want an accumulating counter, you'll need two variables: global timecounter = 0 global totaltime = 0 to start counting do: timecounter = systime() to display do: formatdatetime("%H:%M:%S", (systime()-timecounter) * (timecounter != 0) + totaltime) This uses a little boolean math to only include the running time (timecounter) part when the counter is counting. to stop counting do: totaltime += systime() - timecounter timecounter = 0 to reset do (when timer is stopped): totaltime = 0
  12. Well, as I said, you have to put V. in front of all your V channels. To clear the history, just do V.MyChannel.ClearHistory(). That all said, I'd use test channels instead. Just create regular channels with device type test, I/O type A/D and a Timing of 0. Then you can do: MyChannel.AddValue(Eingang0[0]) The advantage of this is that you can utilize all the other channel features such as logging, averaging, broadcasting (if using >= DF-Standard), and the persist files.
  13. Well, first I'd have to ask why you are using V channels? They are a bit old school and most of their features have been replaced by better solutions. But as to why your code doesn't work, you have to put V. in front of V channels because technically the channels are on the V connection. Also, note that you won't really easily be able to log these channels. You'd pretty much have to use an export set. Also, be careful about this: V.Virtual1 = Eingang0 By not subsetting Eingang0 you are technically trying to add the entire history of Eingang0 to the v channel. I believe in this mode, with =, it will actually only put the latest value, but its much better to be specific as to what you want: V.Virtual1 = Eingang0[0]
  14. AzeoTech

    Streaming counter

    Yup, sorry about that. I forgot to mention that detail. DAQFactory doesn't know that you are streaming a counter. The driver is designed to be open so that when LabJack releases new hardware and new features, it will work immediately with DAQFactory. So, all the stream data comes in on the A to D I/O type because as far as DF is concerned, its all analog input...
  15. AzeoTech

    Flowmeter - pulse or voltage?

    Whenever you have a choice between a device that outputs pulses and the same device that outputs volts for the same measurement you should choose the pulses. This is of course provided you are using one of the LabJack devices (any type), have an available counter or timer, and the frequency of the pulses is less than the max freq of the counter or timer. The reason is that pulses are digital signals and volts are analog. Like everything else that toutes digital over analog, the reason is that digital signals are less subject to noise. All your device with a voltage output is doing is counting the pulses coming out of the paddle wheel and generating a proportional voltage. Its called a frequency to voltage converter for the simple reason that that's what it does. So, you have a pulse, which is then converted to an analog voltage which you feed into an analog input on a LabJack which converts it to a digital signal. If you use the pulses directly with a counter, you simply have a pulse which the LabJack converts into a digital signal. Notice how "analog" isn't in this method. Exception to this rule: If the distance between your sensor and your LabJack is long and you are in a noisy environment, then there is the possibility of getting a noise spike that looks like a pulse. You can easily check for this by simply stopping the process and making sure the counts remain at 0. If they don't, there are two solutions: 1) move the LabJack closer, either by using a UE9 that supports ethernet, or extending your USB using hubs. Note that you cannot run a USB cable more than 6 feet without a hub. Yes they sell USB cables that are longer than 6 feet, but the spec says 6 feet max and if you want reliability you'll follow the spec. 2) you could use a freq-voltage converter and then a voltage to current converter to get a 4-20mA signal and run that to the Labjack, then put a resistor to convert the current back to voltage and read it with an analog input. Current signals are not subject to noise, thus the reason 4-20mA signals are used in industrial environments. Of course this method requires extra hardware, and will generate noise of its own because of all the conversions so its a bit of a toss up. Which is better really depends on environment. As for how to do it with DAQFactory and U3, go to www.daqexpress.com and you'll find samples that include reading the U3 counter.
  16. AzeoTech

    Streaming counter

    In DAQFactory, instead of multiplying MSW by 2^16 you can just left shift by 16: (MSW << 16) + LSW The parenthesis are required because << is a lower priority operator than +
  17. AzeoTech

    error C1070

    First, go to www.daqexpress.com and download the latest version of DAQExpress. It allows unlimited sequencing. As for your V Channel issue, you have to use V.Chan = newvalue not the AddValue() function.
  18. AzeoTech

    error C1070

    This is because you used a single = sign in your comparison. It must be ==. We may change this in the future as it catches a number of people, but for now you must use == whenever comparing values, and a = when assigning a value. Next a few comments on your sequences: 1) Don't use Time / Goto notation. Its bad form and is only there for backward compatability. Use: while (1) digitalout = 0 delay(30) digitalout = 1 delay(30) endwhile 2) If you really want the setting of the digitals and the readings to sync up, put them in the same sequence: while (1) digitalout = 0 read(Eingang0) Motor1.AddValue(Eingang0[0]) delay(30) digitalout = 1 delay(30) endwhile 3) if you are concerned about propogating time errors (i.e. loop taking slightly longer than 1 minute, use wait() instead of delay(). For those reading this and doing short loops, you have to be careful using wait(), but for your app, where the delays are long, a wait() should be fine.
  19. AzeoTech

    Streaming counter

    Actually you didn't mention that you were using a UE9 originally, thus your original problem. The UE9 / U3 use a different driver then the U12 so anything that applies to the U12, such as Glenn's document and the U12 samples on the CD will not work for the UE9 or U3. For these, you should use the UE9 samples as you did. As for how to stream the counter / digital in's, I leave it to the Labjack guys to tell you the exact commands for this. The DAQFactory UE9/U3 driver pretty much exposes the UD as is, so the functions you would do as documented in the UE9 manual are the ones you would use in DAQFactory, except that you would put quotes around the constant names. You can see this in the stream sample for the UE9, which would make a good starting point. You should only need to specify different channel numbers. The other different between the DAQFactory UE9 / U3 driver and the LabJack UD is that DAQFactory automatically takes care of reading the stream data and putting it in the appropriate channels. Again, the stream sample shows this. You can find the latest samples and the latest release of DAQFactory Express at www.daqexpress.com
  20. AzeoTech

    Streaming counter

    What other samples are working? The ones that run in DAQFactory or the others? When you get Unable To Load LabJack.dll, this means one of two things: 1) You don't have the file LabJack.dll in your DAQFactory directory, or its corrupt (doubtful) 2) You don't have the file ljackuw.dll in your system32 directory, or its the wrong version, or its corrupt (doubtful) For readers using U3 / UE9, you can get a similar error: unable to load labjackn.dll. This happens for the same reasons but different files: 1) labjackn.dll in DAQFactory directory 2) labjackud.dll in system32 directory
  21. AzeoTech

    Auto-increment logging filename

    Probably the easiest way is with the registry. Lets assume you have some script to start the logging set: beginlogging(mylog) In front of that script put: private lognum = registry.lognum lognum++ registry.lognum = lognum logging.mylog.strFileName = "c:\mydata\data_"+doubletostr(lognum)+".dat" beginlogging(mylog) You could technically do this all with just the registry variable I suppose... Note that registry.lognum will default to 0 until you set it to something else. Note that you can actually change the logging file name without stopping the logging set. The logging set will simply close the current file and open the new file name.
  22. AzeoTech

    Streaming counter

    With the U12, once streaming is running, you can't do anything else. So, more than likely, all you need to do is stopstream before you set your digital channel. Also, as a side point, you should put [0] inside your if: if (IO0[0] == 0) Truthfully, it doesn't really change the result, but without it, you end up comparing the entire history of IO0 to 0 and then truncating to one value, which obviously takes longer than just comparing the most recent value, which is what you want anyway.
  23. AzeoTech

    Sequences - Timer Reset

    OK, well, first you have to put all labjack constants (i.e. non-numbers) in quotes. This is probably the main difference between the way functions look in C / VB (in the U3 manual) and in DAQFactory. This is because DAQFactory can't include the C header file so doesn't know what LJ_ioPUT_TIMER_VALUE is, though you could create a constant in script... Once I changed that, and put quotes around LJ_ioPUT_TIMER_VALUE, it worked just fine. So, perhaps: 1) You don't have the latest version of DAQFactory or the LabJack driver. Although this hasn't changed much in a while, you probably should make sure you are running 5.38. Go to www.daqexpress.com for the latest. 2) You don't have the most recent Labjack driver from Labjack. Go to Labjack.com for this. 3) You don't have the latest firmware for your U3. Again, go to labjack.com for this. 4) You are using the wrong pins. You have both counters enabled, and truthfully, I always forget whether the counters come before or after the timers, and I believe they come after. Anyhow, AzeoTech is a software company and we don't have any encoders to test with, but I was able to get counts by simply alternating a wire between gnd and Vs on pins FIO0 and FIO1. Then I was able to click your button that runs the ZeroTimer sequence and the timer got reset to 0. That is, of course, after I put the constant in quotes like you have commented out.
  24. AzeoTech

    Streaming counter

    1) When I StartStream How can I: a) Zero the counter Create a new counter channel, same information as the one you want to clear, but a timing of 0, then in the Quick Note section, select "Reset? Yes". Actually, you come to think of it, you can just select Reset? Yes in your existing counter since you are never reading it. Then when you want to reset the counter, just read the channel. From sequence script you'd just do: read(mycounter) Clear the graph Clear the history of the two channels. In script its just: MyChannel.ClearHistory() So to do all this and stream, you'd create a quick sequence action on your button that looks like this: read(mycounter) // reset the counter mycounter.ClearHistory() Myotherchannel.ClearHistory() read(startstream) Sorry, I don't have the doc in front of me so don't know your exact channel names... 2) After a time the graph starts erasing on the left hand side. Why? Your history length is too short. The history is one of the parameters of the channel. It defaults to 3600 points. Make it 36,000 or more. Remember to do it on both the X and Y axis channels. The history is the number of data points kept in memory for graphing. Rather than use some preset default, DAQFactory lets you decide which channels are important and should have long histories and which are not. 3) How can I StopStream at a particular counter value (length)? You can't really stop it at the exact moment a counter hits a particular amount. You'd need a U3 or UE9 to do that, and truthfully, you'd have to ask the LabJack guys if its even possible with those devices. The problem is that the counter readings are being fed to DAQFactory in blocks, so DAQFactory can only do a comparison when a new block arrives. That said, if a few milliseconds of extra data is ok, just go to the event on your counter channel and put something like this: if (MyCounter[0] > EndLength) read(stopstream) endif EndLength is a variable declared and defined elsewhere. StopStream is your channel for stopping the stream. The event code gets called every time a new block of data is received. I believe with the U12 this is every 64 points, but that's just off the top of my head For U3 and UE9 users: the general logic for doing the above items is the same, but resetting counters and starting and stopping streaming is done differently. Just replace all the read() commands with the appropriate functions, which you can pull out of the samples at www.daqexpress.com.
  25. AzeoTech

    Sequences - Timer Reset

    I don't get any errors with the code you specified. Perhaps you should attach your document. Maybe you are doing something else that is having an adverse affect.