AzeoTech

Administrators
  • Content Count

    5,664
  • Joined

  • Last visited

Everything posted by AzeoTech

  1. AzeoTech

    0 - 5Volt Fader

    Is there any data in the graph? If there isn't, or only a scaler value, then the graph will scale weird because it doesn't have anything to scale. Are you sure it is thawed? There should be green lines at the top and bottom when you left-click on the graph. Are you able to autoscale the y axis and have the scale change? What is your Y expression?
  2. AzeoTech

    0 - 5Volt Fader

    No, none of the LabJack units can act as standalone systems. The 2D graph is probably frozen. When you click on it, it probably has a purple box around it indicating it is frozen. Just right click, select Freeze/Thaw and then Thaw all axes. Angular gauges aren't included in DF-Express, which I assume you are using. You'd have to upgrade to at least DF-Lite for $199 to get gauges. I'm not sure what you want to display on the gauge, but a gauge can display any scaler value, so whatever you want should work.
  3. AzeoTech

    0 - 5Volt Fader

    Is the code you just sent in the channel event? If so, you really shouldn't put a delay() inside a channel event because it will cause the polling loop to slow down. Instead you should have this: if ((start[0] == 1) && (stop[1] == 0)) beginseq(rise) endif Note how I put parenthesis around each separate section of the if. It amounts to the same things, but I strongly recommend always doing this for two reasons: 1) its easier to read 2) unless you have memorized the priorities of operators, its better to use parenthesis to force the compiler to evaluate things the way you want. Now in the rise sequence put: output = input[0] delay(2) while(1) ... endwhile In that first line we set the output to the pot setting recorded on the input. Then we delay 2 seconds, then we go into the loop. Another point: notice that I put [0] after input. [0] means take the most recent value. If you don't put [0], the entire history of input is returned. In this case it doesn't really matter because the "output =" part will automatically take the most recent value, but this time there are three reasons why you should do [0]: 1) once again, its clearer to someone reading the code what you mean. This becomes more important as your code gets more complex. 2) doing [0] allows DAQFactory to optimize memory as it just retreives the most recent value. Without it, it has to retreive the entire history, and then only when it does the = does it get trimmed down to the most recent value. This is a big problem if your histories are large. 3) once again, unless you have memorized all the spots where DAQFactory automatically takes the most recent value (and I haven't even memorized that!) you may not get what you expect.
  4. Yes, that will work, though it is a bit round-about and doesn't have much flexibility. There are many others. Really, though, the TestBit() function is the best and fastest way to determine the state of any bit in an integer if for no other reason then all that code is in C++ rather than in DAQFactory script. C++ code is much faster than DAQFactory script, so any time there is a DAQFactory function to do something you should use that rather than multiple DAQFactory operations. Another example of this is using array math. For example, if you wanted to find the maximum value of a channel you could do: private.max = -999 for (private.x = 0, private.x < NumRows(MyChan), private.x++) if (MyChan[Private.x] > private.max) private.max = MyChan[Private.x] endif endfor but that would be really, really, slow compared to this: private.max = Max(MyChan) Here's another example. Lets say you want to see if array1 and array2 contain the same values. You could create a loop like the max one I showed above, or you could do: private.match = Min(array1 == array2) This is a little more advanced, but is a good example of where a little creativity can yield a dramatic speed benefit over loops. In this case, the part "array1 == array2" will generate a third array containing 0's and 1's. A 0 whenever the matching element of array1 does not equal array2, and 1 when it does. If all the elements of array1 are identical to array2, then array1 == array2 will give an array of all 1's. If some don't match, there will be 1's and 0's, and if none match, all 0's. So, we then take the Min of this array. If there are any 0's, meaning at least one of the elements don't match, the Min is 0. But if all the elements match, the array only contains 1's so the Min is 1.
  5. AzeoTech

    Importing picture

    The best way to ensure the graphic displays right in DAQFactory is to open it up in Microsoft Paint and then cut and paste it out of that program. DAQFactory currently cannot resize bitmap images.
  6. AzeoTech

    0 - 5Volt Fader

    I think we're confusing the term initial voltage. There are two initial voltages really: 1) When the program starts, it initializes the output to a starting voltage. This is the one to use the registry with. 2) When the ramping loop starts, it has an initial voltage to ramp from. This is stored in Var.InitialVoltage and is set by one of the screen components I made in that sample, so is already user settable. My previous post with the registry assumed you were trying to solve #1 since #2 is already implemented. A registry variable is a variable that instead of being stored in memory is stored in the windows registry. Because of this, it persists even if you reboot your computer. Its limited to integers and strings so actually I should have added a multiplier in to allow for non-integer starting voltages. I only suggested using the registry variable in the startup sequences to set the initial voltage on the analog output.
  7. AzeoTech

    HEX display

    Well, I've had cases before where customers didn't quite get that binary, decimal, and hex are all the same thing when talking about numbers. They are just different ways of displaying them. Usually are only two cases where you need to actually do a conversion: 1) With ASCII serial communications when the device sends a string containing a hex value and you need to convert that to base 10 (decimal). 2) When you have a number and for some reason you want to see it displayed on screen (or logged) as a hex string. The key is that the hex values are strings not numbers. A number is a number is a number, it doesn't matter if its hex, decimal, octal or base 23. The computer is going to represent it internally the way it wants and you'll never know. Its only when you want to display it, which requires you to convert it to a string representation, or you want to go the other way and take a string representation and make a number that it makes a difference. That all said, to convert a string hex value to a number you use the expression: Evaluate("0x"+var.strMyString) or if a binary string, use "0b" instead. Under DAQFactory 5.15 there is no way to display a number as a hex string, but in DAQFactory 5.30 you can use the Format() function: Format("%x",var.myvalue)
  8. AzeoTech

    More questions about sequences

    Sorry I didn't see this post earlier, but perhaps the response to your next post answered the questions. Since others may read this, here is the answer to this question: The problem here is that the detect sequences pretty much get started immediately on load before those inputs have had a chance to read. To avoid this error, you can just put a delay(1) or similar to delay the start of those sequences until after the channels have had a chance to read a value. You have the AddValue() functions which should avoid this. Did you still get the error with those lines in place? If so then you have something else going on (like a history of 0 or something) and I'd have to see your document. As I mention in the other post, you need a loop with a delay() in it on these detect sequences to get them to continually monitor. A few more pointers: 1) When monitoring channel values as you are, its actually better to use the Event on the channel instead. The event gets called every time a new value comes in on that channel. By using an event you avoid the C1040 error, avoid having lots of loops, and get quicker (actually the quickest) response. The code in your event would actually be the same as what you have in your detect sequences, except the if's would be with the appropriate channel. Note that you would never want to put a delay() in a channel event as that would stall the next reading. 2) If you want an easy way to avoid startup alerts like this, assuming you had a loop in those detect sequences, you can always add: ignore("all") or just: ignore("C1040") to get the sequence to ignore all errors or errors starting with C1040.
  9. AzeoTech

    0 - 5Volt Fader

    The start voltage is user set. Its called "Var.Initialvoltage" Or did you mean the voltage when the application is started? If so, use a registry variable. So, right now, you have in the startup sequence: Output = 0 Put this instead: Output = Registry.StartVoltage Then create another variable value component that changes the Registry.StartVoltage variable. Then, when you change this variable and restart, the output will be set to that value. Note that Registry variables default to 0.
  10. AzeoTech

    0 - 5Volt Fader

    Did you remember to create the output channel? I've attached a sample showing it working. I didn't know whether you had a U12, UE9, or U3, so I made the Output just a test channel. Hopefully you can build from my sample. As for it being hard, well data acquisition is not super easy, and anyone or anything that is making it really easy is probably hiding things from you that you should understand otherwise you may be trusting results and actions that aren't correct. My favorite example of this is with the discovery of the ozone hole. When the ozone hole was discovered, there was already people measuring ozone for years who never saw the hole. When the announcement was made, they went back and discovered that the programmer, who had made it "easy" for the scientists had made it so values below 50 were marked invalid, thus throwing away all the real data that showed there was a hole. As for other programs that might be easier, well only if you happen to find a program that does exactly what you want. LabView will be much harder, any programming language (VB, C, etc) will be as well. The problem is that everyone needs to do things differently. The first versions of DAQFactory had very limited scripting and tried to avoid programming, but we quickly discovered that then DAQFactory only worked for a very small subset of people who happen to need the features we offered. We thought about simply adding more features, but then the program just gets combursome with menu options. The only way to allow the flexibility to do all the different things people want to do, you have to use some scripting. Unlike LabView, and low level programming languages, DAQFactory takes care of a lot for you. Plus you can use a lot of the non-programming features and just supplement it with some scripting for your unique application. And then of course, you can always post here when you have problems and get a quick answer risesample.ctl
  11. AzeoTech

    0 - 5Volt Fader

    The private means the variable is only visible from within the sequence. This is done to avoid cluttering the global namespace. Basically that just means it is done to keep from having too many different names accessible globally. With DAQFactory 5.30 this becomes even more of an issue for reasons I'll skip for now. Anyhow, in general if you just need a variable in a single sequence you should use a private, and if you want to change it elsewhere you should use a global (var.) variable. Var. variables can be used any place you would use an output channel, so, for example, you could create a Variable Value component and then open its properties, click on "Analog Out" button in the bottom right and enter "Var.TotalTime". What this button does is set the Action of the component (on the Action tab of the properties) to "Set To" and the set to channel to the Var.TotalTime variable. The SetTo action prompts the user for a new value and then sets the variable to that value. If you have not done so already, you may want to go through the Guided Tour in the help / manual. And for more info on variables, and the scripting code, review the chapter on sequences.
  12. AzeoTech

    0 - 5Volt Fader

    OK, well here's a sequence that slopes a D to A output over a fixed amount of time and at a certain update rate: Var.TotalTime = 300 // total change time in seconds Var.UpdateTime = 1 // how often to change output Var.InitialVoltage = 1 // starting voltage Var.EndVoltage = 5 // ending voltage // note that the above could be set elsewhere, for example with a screen component private.starttime = SysTime() while (SysTime() < Private.starttime + Var.TotalTime) Output = Var.InitialVoltage + (SysTime() - private.starttime) / Var.TotalTime * (Var.EndVoltage - Var.InitialVoltage) delay(Var.UpdateTime) endwhile Output = Var.EndVoltage // make sure we are at end since last step could be missed So, in the meat of the loop, we first record the time we start the transition. Then, while the totaltime has not elapsed we loop. On each iteration we set the output channel. The formula is made up of several parts. The (SysTime()-private.starttime) / Var.TotalTime returns a number between 0 and 1 where 0 is the start and 1 means the total time has elapsed. We then multiply this by the total voltage change and add that to the initial voltage. After setting, we delay for the update interval and then loop. When the loop quits, we set the output to the target voltage to ensure we got the last step. This is because depending on the timing of the loop the final output setting might not occur within the loop.
  13. AzeoTech

    0 - 5Volt Fader

    I'm not really sure exactly what you are trying to do. But first, and I only mention it because if I don't say it, you may never know, but 0-5volt is voltage not current. Current is typical in units of Amps and a power supply that allows you to vary the current is a completely different beast. OK, that said, you have just a regular variable power supply with a pot to adjust the voltage on the PS. You want to be able to set the power supply to 5 volts from within DAQFactory no matter what the pot says? If so, this is actually a bit trickier then you'd think. You have to look at the Pot and see what it is doing. If its just a simple voltage divider on the output, then you could use a relay to bypass it. If its controlling some internal circuitry, you have to figure out how it works. It could be grounding the circuitry to set it to 5V or doing the opposite. That's why its tricky, and if done wrong you could blow the power supply. What you may want to do is keep the power supply set at 5V all the time, and then put your own bypassable pot downstream of the powersupply. Truthfully, I'm the software guy, so perhaps others can contribute here about how best to implement the hardware side. So, moving on to my area: what do you want the software to do? Do you want it to control the voltage all round (if so you can use an I/O module)? What determines what voltage to output? As for your code: 1) Pretty much any time you want to monitor an input you should use an event as I showed you in your previous enquiry. 2) There is no "then" statement in DAQFactory 3) "(Digout + 1)" is not a valid statement either since it doesn't say where to put the value digout+1. "Digout = Digout + 1" is valid, or "Digout = 1" 4) There are only very rare reasons to use wait(). You should use delay() instead in general. 5) The indenting should look more like this: while (1) read(inputvalue) if (Inputvalue <= 5) Digout = 1 endif delay(1) endwhile
  14. AzeoTech

    timer function

    I'm a little confused want you want, but I believe you want to monitor a digital input and if it goes high (i.e. switch closed) you want to light an LED for 15 seconds by setting a digout high and then low again after 15 seconds. To do this, you'll of course need a digital input and digital output channel. Lets say they are called DigIn and DigOut. 1) In the event for DigIn (click on the "DigIn" in the workspace under CHANNELS: then select the Event tab), put: if ((DigIn[0] == 1) && (DigIn[1] == 0)) beginseq(PulseLED) endif This looks for when the digital signal goes high after being low. 2) Next create a sequence called PulseLED and put: DigOut = 1 // turn on LED delay(15) // wait 15 seconds DigOut = 0 // turn off LED The event will cause this to run when the switch is pressed. If the switch is pressed while the LED is already on nothing additional will happen.
  15. AzeoTech

    question about sequence execution

    Oh, and since this seems to be the question of the day and relates: The only way to control the order in which multiple sequences auto-start is to do what you did and create a single auto-start sequence and have that start your other sequences.
  16. AzeoTech

    question about sequence execution

    No, sequences run until they don't have any more statements to exectute. A sequence will only run forever if you have a loop in it. So this sequence: var.a = 3 var.b = 4 beginseq(myotherseq) will set a and b and start myotherseq and then stop since it ran out of things to do. However, this sequence: while (1) var.a = 3 var.b = 4 beginseq(myotherseq) endwhile would repeated set a and b and try to start myotherseq. "while(1)" means loop forever because 1 is the same as true. Since myotherseq is probably already running the second time around, it will not restart it, but instead the second and subsequent execution of beginseq(myotherseq) would probably do nothing. Once myotherseq stopped though some other means, this sequence would restart it. Please note: you would NEVER want to do the second sequence as it is essentially an infinite loop. If the sequence priority was anything other than 0, you would most likely hang DAQFactory. If it is 0, your graph and image drawing might be sluggish. Instead, you should pretty much always have a delay() inside the loop. The delay typically should be at least 0.01: while (1) var.a = 3 var.b = 4 beginseq(myotherseq) delay(1) endwhile
  17. AzeoTech

    HEX display

    Well it depends. Where is this binary value stored? In a string I presume?
  18. AzeoTech

    DAQFactory file compilation

    No, this is not possible with DAQFactory. The Runtime License is required.
  19. AzeoTech

    Importing picture

    There is not a way to directly import a picture into DAQFactory. However, you can copy and paste images into DAQFactory. You might need to resize your image with another program before pasting it into DAQFactory. Once you paste the image into DAQFactory, it becomes a symbol component. It can be a static symbol or you can animate/change the symbol based on a value. For example you could change the symbols location based on a value.
  20. A simple sequence such as the following will store the bits to an array in the variable Var.Binary. Var.Decimal = 255 Private.j = 0 for (Private.i = 7, Private.i >= 0, Private.i--) Var.Binary[Private.j] = TestBit(Var.Decimal,Private.i) Private.j++ endfor
  21. As LabJack Support mentioned, the easiest way would be to use original integer with the TestBit() function rather than the string. However, if you prefer to use the string, there is a way to do it with the Evaluate() and Mid() functions. For example: if your string is Private.strBinary and you want the third bit do something like this. Var.thirdbit = Evaluate(Mid(Private.strBinary,2,1)) The Mid() function returns a subset from the center of the string. From the above code it will look skip the first two characters (2) and then return a single (1) character. The Evaluate function converts the character from a string to a value that you can use in mathematical functions. You may or may not need the Evaluate function.
  22. Email functions are not supported in DAQFactory Express, although this is easily accomplished with a higher version of DAQFactory. The cheapest version to support Email functions is DAQFactory Base which retails for $399 USD. See the following link for a list of features for each version and their respective price. http://www.azeotech.com/dffeaturegrid.php You mention that you use eight channels for the voltage to fahrenheit conversion. Instead of taking up channels for this conversion you could do a conversion using CONVERSIONS: under the Workspace and applying it to the appropriate channel. Or another way to do it without using up channels is to do the conversion directly in a display component.
  23. AzeoTech

    Factory Express - playback

    With DAQFactory you can reload data from files to view it at a later date. Unfortunately this functionality is beyond the scope of DAQFactory Express. There is a sample on the Azetoech Knowledgebase that shows how to do this, but you would only be able to use this sample with a higher version of DAQFactory. The following will link you to where you can download the sample. http://www.azeotech.com/faq.php?do=article...le&articleid=76 A possible way around this (using Express) is using the Vchannels. You could save each batch of data within the program into Vchannels and then graph the Vchannels as you want to see them. The best way to do this is by creating a Vchannel (virtual channel) and then in the Event of your regular channel add code like this. V.MyVChannel = MyChannel[0] Everytime an new data point is read into MyChannel it will be saved into the Vchannel V.MyVChannel. Of course for every new batch of data you will need to create a new Vchannel and change the code in the channel Event. One other thing to note is that since you are storing all the data inside the program rather than in separate data files, the size of the program can get large.
  24. AzeoTech

    DAQFactory Express

    DAQFactory Express has been shipping with the LabJacks for over a year now, so if your LabJack is older than this it is possible that it is not on your installation CD and you should contact LabJack at support@labjack.com. If your LabJack is less than a year old, run the installation from your CD again and make sure you check the box to install DAQFactory Express. After the installation is complete, DAQFactory Express will show up as it's own program group under Start => All Programs => DAQFactory Express.
  25. AzeoTech

    Digital output issue

    The AddValue function is not used for writing values to output channels, it is meant for writing values to a channels history. To simply use code to set your output channel use the following: Dout1 = 1 If your output channel is a digital output this will set it to digital output high. If your outut is an analog output it will set it at 1 volt.