• Content Count

  • Joined

  • Last visited

Everything posted by AzeoTech

  1. AzeoTech

    Newbie sequence question

    Yes, just create a logging set and log to a CSV (ASCII delimited) file as is shown in the guided tour and in the logging section of the help. Once in CSV form you can load into any application to do graphing. The easiest and most common for most people is Excel. Great, it sounds like you have a handle on it. I hope you understand our concern.
  2. AzeoTech

    Newbie sequence question

    That is true. It just depends on how much you want DAQFactory to do for you while taking data, and how much you want to do afterwards using a data analysis tool. Personally I would log all data as jfiddler recommended and then analyze it afterwards, but if you only wanted to log after the brake was depressed, go to the event for the brake channel and add code something like this: if (Brakechannel[0]) // assume 1 means brake depressed, 0 not beginlogging(mylog) endif You'll have to stop logging manually, or use an event on the speed channel to turn off logging when it gets to 0. Finally, I delayed initially responding to this post because I am concerned about the danger of modifying a motorcycle and the potential of adversely affecting the braking system on the bike and injuring yourself. This is much more of an issue on a motor bike than a car. Remember, even tapping into an existing system can cause problems if not done correctly, especially with today's advanced automotive systems. Tapping into safety systems (like brakes, airbags, steering, etc.) should only be done by the manufacturer of the safety systems and with proper testing. For this reason AzeoTech is strongly recommending that you do not do this experiment on the road and instead do it on a stationary dyno, which is the proper place to do it and would be much, much safer. Even if you do it on the dyno, you should probably replace any modified parts before riding the same bike on the road. Please re-read the end user license agreement of DAQFactory and the warning in the beginning of the LabJack manuals as well.
  3. Its actually quite simple. Create a channel with I/O type "Special", channel #0 and set the timing to your desired polling interval. Then create another but channel #1 with a timing of 0. The temperature reading will go into channel 0, and the RH into channel 1.
  4. The LabJack guys will have to confirm this, but I believe for the timers work with discrete signals and not analog signals like you have. Technically you could probably stream the signal as an analog signal and let DAQFactory calculate the timing, but this won't give you the precision since the timers have a much higher time resolution than the streaming analog. So, personally, I'd use a schmidt trigger to convert the analog signal into a digital signal. Again, the LabJack guys (who are much better at hardware than I am) may want to chime in on this and make some recommendations. For example, I don't know if there is anything special in getting a schmidt trigger to work on fast signals. In general, a schmidt trigger is a very simply circuit that you should be able to create with components from Radio Shack.
  5. Inserttime is a function, just like Sine. Lets say you have a variable that you want to put time into. There are actually two ways you can do this: myvar = inserttime(myvar,systime(),-1) or: myvar.time[0] = systime() Then you can put the value in a channel using AddValue(): Mychannel.addvalue(myvar) You cannot change the time of a channel value once it is in a channel.
  6. AzeoTech

    Streaming from the sound card

    To get you started, I've attached a simple stream example of 4 channels. To get the peak along the left side of the graph you should calc the max of the scan, get the time of that point, and set the ScaleFrom to that time and the scaleto to that time plus whatever time width you want. So, for example, you might put: GetTime(Max(AIN3)) for ScaleFrom and GetTime(Max(AIN3))+1 for ScaleTo to get a graph with just one second width. To put the max on the right side, switch it and do -1 instead of +1. Note that you'll need to uncheck "Time Width" to enable the scalefrom/scaleto in the graph. I'm not quite sure what you want with the "automatic timebase management", but check out the shifttime() function, which would allow you to adjust the different traces in time. You would use it in the secondary traces. So if you want all the max peak of two different traces to appear along the left side of the graph where the maxes may occur at different times you would start with the code I mentioned above to set the X axis scaling, and then (assuming your other channel was AIN2), you'd create two traces. The first trace would have a Y Expression of just: AIN3 the second would use shifttime to move the max of AIN2 to the same time as the max of AIN3: ShiftTime(AIN2,GetTime(Max(AIN3)) - GetTime(Max(AIN2))) Note, of course, that the time axis is only the time of the datapoints of AIN3, though the deltaT will be the same. We didn't scale time, we just shifted it to align the peaks. Finally, lets say you want the peak to appear just to the right of the left axis so you can see the leading edge of the peak. In this case, just subtract a little from the scalefrom and scaleto: ScaleFrom: GetTime(Max(AIN3)) - 0.1 ScaleTo: GetTime(Max(AIN3)) + 0.9 Then, just to top it off, if you then wanted to mark the max point (which would then be 0.1 seconds from the left axis), you could use a line annotation to put a dashed line. The line annotation would have an expression of: GetTime(Max(AIN3)) and you'd select the Bottom Axis. I guess the key point that I never mentioned is that when you do Max(AIN3), this returns the max of AIN3, but it also keeps the time of the max in the value as well. DAQFactory keeps time associated with values, and to retrieve the time portion of the value, we use the GetTime() function, so GetTime(Max(AIN3)) returns the time of the max point of AIN3. This can be used for Min as well. The rest of this is just doing math on the time, remembering that time in DAQFactory is just a number that corresponds to the number of seconds since 1970, so it can easily be added or subtracted. ShiftTime() does this to the time portion of a value, returning that same value with the time shifted by the given amount. Finally, I attached my expansion on the stream simple document that shows this peak alignment working. I didn't have any input and so the values were just floating around 0.15, except of course when I touched the inputs, which would generate a nice peak. You may have to adjust the y scaling to better see your peaks. Just double click on the left axis. As you can see, once you get a little experience with the various functions of DAQFactory, it is real easy to manipulate data to get what you want. U3_Stream_Simple.ctl U3_Stream_Simple_Peaks.ctl
  7. Not in the current release, though DAQFactory will remember the full screen state and restart in the same state. The next release has a document setting for full screen mode.
  8. AzeoTech

    Email attachments

    That's definitely a server error. Not one of seen before I'm afraid. It appears that the server doesn't like the encoding of the attachment. We've had email support for several years and this is the first I've heard this error. My recommendation if you don't want to chase down the server problem is to skip the attachment altogether and put the file into the body. You said you were doing a .csv file, so its text already. Use the File. functions to load the file and put it into the body. It'd be something like this: // open the file private.handle = File.Open("c:\mydata.csv",1,0,0,0) // get the length private.length = File.GetLength(handle) // read the entire file and put into the body of the email email.strBody = File.Read(handle, length) // close the file file.Close(handle)
  9. AzeoTech

    Email attachments

    It is most likely an issue with your server. Are you getting an error message? Are you able to send without attachments? Here's the code I used to test (xxx's replacing details that shouldn't be posted): email.strHost = "" email.strUserName = "xxxxxxxx" email.strPassword = "xxxxxxx" email.strAuthenticate = "AuthLogin" email.strBody = "test" email.strTo = "" email.strReplyAddress = "" email.strFile = "c:\trimtable.csv" email.Send() This worked perfectly.
  10. My first guess is that you set the ID of one of the devices to 0. You cannot use the 0 ID or 0 D# if you are using more than one LabJack. Otherwise it does first found and likely is finding the same labjack twice. Thus, its unable to claim that labjack and you are only getting a couple of them working at once. So, just to restate: You can only use D# 0 or ID #0 if you are using a single LabJack. This applies to all LabJacks under DAQFactory including the U3 and UE9.
  11. There are two separate issues here: 1) Timer fields are always 0 There are two issues here: 1st, you initialize timer 0 to mode 10 and then reinitialize it to your other mode. I think you want to put a 1 for channel in your AddRequest() line. Also, there is a firmware issue because the timer used to trigger the stream overrides the system timer and so even once you change that, you'll simply get the same number over. The LabJack guys have fixed this and posted a beta firmware update at: I'll leave it to them to comment on this. 2) The amount of data captured in the file is indicating the data rate is only about 100Hz, not 1kHz. Just to recap from a different post: When doing external triggering DAQFactory is unable to determine the exact time of the trigger. This is because the data comes in in blocks of 16, so except for the last point, it has no idea what the other times are. In fact, it doesn't really pay attention to the fact that you are external triggering, and simply assumes you are sampling at whatever stream rate you specified. In your case, you didn't specify any, so it used the default 100hz rate. So, all your data is spaced at 100hz. This is why Jon is reading the system timer: to get the actual data point time. Now the effect on logging: since you data is being spaced at 100hz, but the real data is around 1khz, the data being logged quickly gets assigned times that are in the future. Because of the way Logging Sets work to align data, this will cause the future data to queue up in memory until that future time arrives or you stop the logging set, which is why it appears not to work. The solution: if you are doing external triggering, send the LabJack the normal stream frequency command: LJ_chSTREAM_SCAN_FREQUENCY, before setting up the rest of streaming. The value you should set to should be larger than the fastest possible stream rate. This will ensure that all the data remains in the past.
  12. AzeoTech

    unknown error-codes

    Good, then it sounds like you understand what Wait() is for. Note that with the U12, DAQFactory can't really do precise timing that it can do with other devices (including the other Labjacks). This is because of the USB library used by the U12. As for your problems, we are still unable to reproduce it. Perhaps the LabJack guys could give it a try and see if they get the same issues? The DAQFactory U12 driver hasn't been changed in years and thus is quite stable. I don't think the U12 drivers have changed in a while either and I haven't heard of these issues with others. My guess is that something on your computer is causing this problem. Perhaps you have another device on an USB port that is occasionally pulling just over the power limit on the port? There are a lot of interactions between devices plugged into a PC that are not competely obvious. This is largely because motherboard manfacturers try to put multiple subsystems on the same bus or power supplies instead of isolating each one. It could also be radio interference, or it could just be a defective U12. Have you tried the U12 on other computers? In other locations (i.e. a different building)? Have you tried using LJLogger instead of DAQFactory?
  13. AzeoTech

    Vista Hard Key Support

    The manufacturer of the hardkey has released a beta for this. I believe the only issue now is that it will show up as an unsigned driver. They are working on getting it signed and expect it in a few weeks. You can go to to download this version. You want the MPI version, not the SmarxOS version. We have not tested it so can not guarentee that it will work.
  14. You can't do this. First, its not possible with DAQFactory, and second you probably don't want to do it anyway. The real question is why your labjack still gives these errors. This is not typical and indicates something is wrong. First, update everything to the current versions. Go to and for the latest. Next, try rebooting, then starting DAQFactory Express before starting anything else, then create a new document and add a few channels and see if you still get these errors. If you do, then reboot and try the LabJack tools like LJLogger and see if they give the same issue. If you don't get errors within Express then you are doing something weird in your document, or you are quitting DAQFactory and restarting without giving the first instance a change to shut down. The other possibility is that you have an ljackuw.dll in your DAQFactory directory and its not getting updated when you update the labjack drivers. If you do have this file in the DF directory, delete it after quitting DAQFactory.
  15. AzeoTech

    button to start logging

    Just change the if section: if ((switch[0] == 1) &amp;&amp; (volt[0] &lt; 1.5) beginlogging(log) endif if (volt[0] &gt;= 1.5) endlogging(log) endif This means if the switch is pressed and voltage is < 1.5 it will start the logging set. If the switch is released, the logging set will stay running. If you don't want that, change the endif / if(volt[0]..) lines to an else: if ((switch[0] == 1) &amp;&amp; (volt[0] &lt; 1.5) beginlogging(log) else endlogging(log) endif If the switch is pressed and the volts goes >= 1.5 the logging is stopped no matter what.
  16. AzeoTech

    edit box

    Use a global string variable that is set by the edit box: global string filename Make sure Set on Submit is set in the edit box. Then, create a button that changes the file name and path to the one specified. The button would have two actions, the first does Submit. The second is a quick sequence with: logging.loggingset.strFileName = "c:\mypath\" + filename
  17. AzeoTech

    parallel traces in a graph

    Sorry, I don't really understand what the problem is. As for your variable question, you have to declare the variables somewhere. Just do: global way_cal global force_cal As for the graph itself, one idea is that you could offset the cal by a little bit. Alternatively, you could make the cal display on the right axis and in point mode, and the real trace in line mode on the left axis.
  18. AzeoTech

    unknown error-codes

    First, I'd make sure you have the latest versions of everything. Go to to get the latest DAQFactory Express. Go to to get the latest LabJack drivers. Next, does this happen after you stop DAQFactory and restart only? If so, DAQFactory may not be shutting down completely before you restart. Run task manager and look at the process tab and make sure you DAQFactory doesn't show up. From your document I don't see anything wrong, at least not in the channels. You have a lot of script and its not properly indented so I couldn't check that. The one thing I noticed is that you use wait(). I recommend using delay() unless you are sure you want the feature of wait() and understand its use.
  19. Certainly, just add a delay inside the for loops: for (private.c = 0, c &lt; 5, c++) read(Eingang0) delay(0.1) endfor
  20. Well, it depends on whether you want to log the averaged data or not. If you just want to make your graph look better, use the boxcar() function as the expression for your graph. Boxcar is only designed for use with an array of data that you want reduced to a smaller array. If you want everything, including logging, to be averaged, you really want the mean() function because you want to take an array of data and get a single averaged point. To use it, you'd have to accumulate some values: private m1 = 0 private m2 = 0 private count = 0 while (1) count++ DigitalOut = 0 read(Eingang0) m1 += eingang0[0] if (count == 5) Motor01.AddValue(m1/count) m1 = 0 endif delay (30) DigitalOut = 1 read(Eingang0) m2 += eingang0[0] if (count == 5) Motor02.AddValue(m2/count) m2 = 0 endif delay (30) endwhile This assumes you still want to alternate readings. If instead you want to read eingang rapidly and then have it put the average in motor01 do something like: while (1) DigitalOut = 0 for (private.c = 0, c &lt; 5, c++) read(Eingang0) endfor Motor01.AddValue(mean(eingang0[0,4])) delay (30) DigitalOut = 1 for (private.c = 0, c &lt; 5, c++) read(Eingang0) endfor Motor02.AddValue(mean(eingang0[0,4])) delay (30) endwhile
  21. AzeoTech

    unable to load file!!!

    99.9% of the time this happens when you try to load a document created with a newer version of DAQFactory with an older release. Make sure your new computer has the latest release by downloading an update from If that doesn't fix it then the file got corrupted at some point, probably due to disk error, which is why backups are so important.
  22. AzeoTech

    graph control with edit box or button

    I'm a little unsure what the problem is. If you don't have an else, just don't put one: if (System.MessageBox("Do you really want to stop?","YesNo") == "Yes") Mychannel.ClearHistory() endif
  23. Yes. First you have to name your graph: select the graph and right click and select "Component Name...". Lets say you call it MyGraph. Next, you need to put a trace on the graph for your initial channel. You'll need to name the trace. This is about half way down on the trace page. Now you can change the Y expression programmatically: Component.MyGraph.MyTrace.strYExpression = "V.Motor5" There are a variety of components: combo, radio, button, etc. that can be used to actually set this value.
  24. AzeoTech

    graph control with edit box or button

    Just use an if to see what the current expression is: if (Component.MyGraph.MyTrace.strYExpression == "V.Motor5") Component.MyGraph.MyTrace.strYExpression = "" else Component.MyGraph.MyTrace.strYExpression = "V.Motor5" endif This will toggle the graph display between V.Motor5 and nothing.
  25. AzeoTech

    graph control with edit box or button

    Sure, lets say your sequence is MySequence and you named your button MyButton. In the quick sequence action for the button put: if (Sequence.MySequence.Running) if (System.MessageBox("Do you really want to stop?","YesNo") == "Yes") endseq(MySequence) Component.MyButton.BackColor = RGB(0,0,0) endif else beginseq(MySequence) Component.MyButton.BackColor = RGB(0,255,0) endif