AzeoTech

Administrators
  • Content Count

    5,672
  • Joined

  • Last visited

Everything posted by AzeoTech

  1. Not directly. But you'd simply have to create a global variable, set that variable, start the sequence, then use the variable inside the sequence. I suggest naming your globals something with the sequence name, for example: mySequence_variableName. There are ways to run functions in their own thread, though this is usually best done inside an object to avoid losing track of the thread.
  2. Starting and stopping the stream like that is impossible because DAQFactory only sees the data in blocks. You can log that data, however, using an export set. Just clear the history of the channel before starting the stream (myChannel.clearHistory()), then start the stream. Once you stop the stream you can log the first 125 values using the expression: myChannel[numrows(myChannel)-126, numrows(myChannel)-1] in the export set.
  3. Most no. You have the wrong hex values. You have to think in binary, and might want to use binary notation instead:: D7-D4 (Batt_Status[0]>>4) & 0b1111 and D3-D0 Batt_Status[0] & 0b1111 if I named A16 CES and I wanted the charging status (D3-D2) (CES[0]>>2) & 0b0011 if I wanted A16 D15-D14 would it be (CES[0]>>14) & 0b11
  4. AzeoTech

    Read Pressure Device

    Good. Actually I pretty much never use the user serial protocols unless I need to create a protocol that I will use across multiple documents. It is much easier to develop protocol code in a sequence. In fact, even if I expect to create a user serial protocol, I'll still develop it first in a sequence to test it, then migrate it over.
  5. AzeoTech

    windows 10 saving

    This actually has more to do with default security settings for folders in Windows 10, along with changes in how DAQFactory installs. By default, the DAQFactory installation folder (and most of its subfolders) are marked read-only to non-admins. Simply running as Admin doesn't get you past this. So, you have to go the folder you are trying to log to in Windows Explorer, and change the security on that folder to allow Everyone to write to the folder.
  6. AzeoTech

    Calculate rms value of an an array

    I don't think so. You were on the right track at the bottom, but the field labelled RMS is: max(captureddata) / 2^0.5 when it should be: mean(captureData^2) ^ 0.5
  7. AzeoTech

    Logging on a specific treshold

    #1) do you only want to log after the time the channel becomes greater than X? I.e. when it crosses the threshold? First of all, there are time latencies that can't be avoided if you do this in software. This comes from both the delays in communications with hardware, and with how often you query the input. For example, if your Timing is set to 0.1, then even ignoring comm delays, DAQFactory may not know if the channel crossed the threshold for 99.99 ms. There are a couple ways around this, as you can't query the input faster than maybe every 10 or 20 ms. Even if you stream, you can't do the logic in-situ because in stream mode, the data comes in in blocks. The first way is to stream, but stream both channels, then analyze the data in blocks as they come in. This is a bit more complicated to achieve, and is usually best done in a separate sequence. The problem with this is that you still are subject to the latencies of streaming, but you can stream really fast and get that well below a millisecond. If, however, you really need it super tight, you will have to use hardware triggering. Use a schmidt trigger to set a digital signal for when the threshold is crossed, and feed that trigger into a trigger input on your DAQ device. The LabJack supports this sort of thing, but I don't know what hardware you are using. #2) this is much easier. Create a global variable called, say, "startTime", declared in an auto-start sequence. Then at the top of the sequence you want to top, do: startTime = systime() Then, wherever you want to display the elapsed time, use something like: iif(mySequence.running, systime() - startTime, 0)
  8. AzeoTech

    Calculate rms value of an an array

    Yup, but I'm not sure how well it will work with quantized data. The accuracy is going to depend on the sampling interval, and some sort of curve fit might be helpful. But ignoring that and assuming you have a channel / array "X" with your data, the RMS calculation in DAQFactory would simply be: mean(x^2) ^ 0.5 Remember, doing x^2 returns an array the same size as x, where each value of x is squared. Mean() takes the mean of whatever array is provided to it. And ^ 0.5 raises whatever is to the left to the 1/2 power, which is the same as square root.
  9. That's a Modbus specific error returned by your device. You'd have to check your device docs as the meaning of that really depends on the device.
  10. First get it so you can manually control the Tick DACs. I'm pretty sure there is sample code on the LabJack website. After you have that working, then you can put the desired code in the Event for the appropriate channel. Event's are code in channels that get executed every time the channel gets a new value. You get to them by expanding CHANNlELS: in the workspace, clicking on a specific channel, then selecting the Events tab.
  11. AzeoTech

    Calculate rms value of an an array

    There is no built in function for calculating RMS, but if you can point me to a page with the formula you'd like to use, I can probably show you how to write it in DAQFactory.
  12. What do you mean by counting? Do you want to read 125 times then stop? I'm unsure what you want to do.
  13. AzeoTech

    CRC &LT

    OK, somewhere along the line, the system or your browser encoded the code for browser compatibility. &gt; means a greater than sign. &lt; is less than, &amp; is the amperstand. Once you replace those it should make sense. Note however that this is the CRC for Modbus. Not all systems use the same CRC and you should probably look at your device's documentation to see how they do it. private crc = 0xffff private raw = asca(buffer) for (private x = 0, x < GetLength(buffer), x++) crc = crc # raw[x] for (private j = 0, j < 8, j++) if (crc & 0x0001) crc = crc >> 1 crc = crc # 0xA001 else crc = crc >> 1 endif endfor endfor return(crc)
  14. It would not be difficult to create one as I believe every variable, even the event (strEvent) code is available from script. Use channel.listAll("groupName") to retrieve a list of channels, then loop through that list and using execute() copy all the parameters from one to the other, remembering to change the group name, as well as the channel name for the new channels.
  15. My guess is that they are specifying the function codes in hex, as 10 hex is 16 decimal. Especially since there is no function 10 in standard Modbus. So you should be able to use code 16. If it isn't working it may be an alignment issue. What error are you getting?
  16. I don't know what you have. Can you post your script?
  17. AzeoTech

    Pop up message

    It means the document is open by another program exclusively and DAQFactory can't access it. It is not a message I've ever seen with a DAQFactory document, especially since DAQFactory doesn't access the .ctl document except when it is loading and saving. Are you perhaps triggering a save from script?
  18. Sure, just do: read(myChannel)
  19. It depends on what communication card you have. It looks like all of the serial CJ communication units support Modbus which would be easy to use with DAQFactory. The other boards are ethernet based and use Devicenet, Ethernet/IP or Profibus which would require an OPC server or protocol converter.
  20. You have to put quotes around any string literals in your SQL statement. So at the end it is: ',"' + Placa[0]+'")') It's hard to see here, but I replaced the double quotes with single quotes and put double quotes inside. DAQFactory treats them the same as long as they are paired up, but I don't know if SQL SERVER supports single quotes. I usually find it helpful to copy my db.execute() line to another line before it, and remove it down to just a ? (print) statement: ? "INSERT INTO Alival_Descargue.dbo.Estados_PLC(Fecha,VolumenRemisionado,Temperatura,Placa) VALUES (CONVERT(datetime,GETDATE(),20),"+Volumen_remisionado[0]+","+TemperaturaLlegada[0]+","+Placa[0]+")" Then you will see the actual SQL statement that you generated in the command alert window. You can even copy / paste it into a SQL command line and let SQL Server tell you exactly where the error is. But I know it will be the lack of quotes, as your's will evaluate to something like: INSERT INTO Alival_Descargue.dbo.Estados_PLC(Fecha,VolumenRemisionado,Temperatura,Placa) VALUES (CONVERT(datetime,GETDATE(),20),1,2,MyString) where you really want: INSERT INTO Alival_Descargue.dbo.Estados_PLC(Fecha,VolumenRemisionado,Temperatura,Placa) VALUES (CONVERT(datetime,GETDATE(),20),1,2,"MyString")
  21. No, you are not missing anything. V channels are largely left over from before DAQFactory had real scripting with variables. However, it seems many user's still use them, so we haven't removed them. If you have some suggestions on ways to improve them, please post them on the Suggestions forum and there is a good chance they will get implemented.
  22. AzeoTech

    Software Update Policy Question

    The current version is 17.1. You can download it here: http://www.azeotech.com/j/download-daqfactory-final.html Just download and install over your existing install. Revision history is here: http://www.azeotech.com/j/revision-history.html
  23. For a single flag it is especially easy: private handle = file.open("c:\data\myfile.txt", 0, 1, 0, 1) file.write(handle,"5") file.close(handle) or to read from the file: private handle = file.open("c:\data\myfile.txt", 1,0, 0, 1) private string datain = file.read(handle) file.close(handle)
  24. AzeoTech

    Graph appearance

    Jeff, I believe that is just a matter of what order you add the traces. I can't remember which way it goes, but try adding the traces line first then area, and if that doesn't work, do it the opposite on a new graph.