Download NJ Programming Best Practices
Transcript
Converting Read and Write Text Strings to Variable Data The NJ has a very powerful instruction for interpreting data from a .csv file. The “SubDelimiter” function. You can also take a variable of custom data type and convert to text ready to be sent to a file using the AddDelimiter function. For example: The first line of the file is Bob,5,182.3,True With the SubDelimiter instruction you create a variable with a custom data type like so: Variable: TextStringConverted which would be of type TextStringConvereted_Struct Data Type: TextStringConvereted_Struct with members Name of base type “String[256] Age of base type “INT” Height of base type “REAL” Male of base type “BOOL” Scan Times How a PID instruction Affects Scan Time My testing showed 10 loops ran an average of 218μs. Peak was 315μs. How “Auto Tune” Affects Scan Time There is no scan time value for instructions on the NJ. But testing at the factory has shown that initiating 90 auto tune loops at the same time added about 3ms to the scan time. This could be a problem if you put them in the main task. It is also important to know that you should not run a PID loop (actually the auto tune PID loops) in a scan that runs slower than 8ms. My actual testing showed 10 loops auto tuning gave a scan time of 259μs (up from 218μs for just the PID loop) for about two seconds till the PID tuning was complete. 21