meerooo80 Posted May 23, 2014 Posted May 23, 2014 We are using the sequence below to log a TOC analyzer to DAQFactory. However, it is giving me an 'uncaught error' in line 4. device.TOCOutput.purge() while(1) try private string datain = device.TOCOutput.ReadUntil(13) // Modifying string for IC private string vIC = delete(datain,1,32) vIC = delete(vIC,5,17) //Modifying string for TC private string vTC = delete(datain,1,36) vTC = delete(vTC,5,13) //Modifying string for TOC private string vTOC = delete(datain,1,27) vTOC = delete(vTOC,5,22) delay(1) endwhile
AzeoTech Posted May 23, 2014 Posted May 23, 2014 The sequence doesn't compile because you have a try but no catch. The indenting should give that away. At the end you skip back 6 spaces instead of 3 to the endwhile which tells you you missed something.
meerooo80 Posted May 23, 2014 Author Posted May 23, 2014 Oh thanks, it works now however I do not get the correct numbers because my guess I should manipulate this code for a serial connection since it was written for an ethernet connection?
AzeoTech Posted May 27, 2014 Posted May 27, 2014 DAQFactory treats serial and ethernet the same. If you are getting the wrong numbers, you are probably parsing the data incorrectly.
AzeoTech Posted May 27, 2014 Posted May 27, 2014 I'd need to know more about the format of the data stream to help you.
meerooo80 Posted May 28, 2014 Author Posted May 28, 2014 How do I get the string from the Command Monitor?
AzeoTech Posted May 28, 2014 Posted May 28, 2014 What do you mean? Do you mean copy it to the clipboard? Select and right click and pick "Copy"
meerooo80 Posted June 2, 2014 Author Posted June 2, 2014 No I mean how do I get DAQFactory to generate the string on Comm Monitor?
AzeoTech Posted June 3, 2014 Posted June 3, 2014 What string? If you want to output something, type it in the area at the top of the comm monitor and hit enter. In order to use the comm monitor, you have to right click and select the desired port.
meerooo80 Posted June 10, 2014 Author Posted June 10, 2014 Here you are: Rx (16:16:38.243): \084\117\114\098\111\044\049\048\032\074\085\078\032\050\048\049\052\044\049\054\058\049\053\058\052\049\044\049\053\049\044\050\051\052\044\051\056\053\044\050\046\048\044\050\046\048\044\078\047\065\013\010
AzeoTech Posted June 10, 2014 Posted June 10, 2014 Can you please repost with the "Display all ASCII chars as Codes" unchecked? Its obvious from those numbers that you have an ASCII string, not a binary protocol, and having that checked gives us binary numbers.
meerooo80 Posted June 11, 2014 Author Posted June 11, 2014 Here you are: Rx (15:03:16.220): Turbo,11 JUN 2014,15:02:31,-2.45,151,149,2.0,2.0,N/A\013\010
AzeoTech Posted June 11, 2014 Posted June 11, 2014 OK, delete() is not the function you want. You want parse. I don't know which number is which, but, for example, to extract the -2.45 you'd do: vIC = parse(datain, 3, ",") for the 151 just change the 3 to a 4, etc.
meerooo80 Posted June 12, 2014 Author Posted June 12, 2014 So I am using the following right now but not yet creating a logging file on the computer. device.TOC.purge() while(1) try // Modifying string for IC vIC = parse(datain,4,",") //Modifying string for TC vTC = parse(datain,5,",") //Modifying string for TOC vTOC = parse(datain,3,",") //Adds Channels for each output IC.AddValue(StrToDouble(vIC)) TC.AddValue(StrToDouble(vTC)) TOC.AddValue(StrToDouble(vTOC)) catch() ? strLastError delay(0.01) endcatch endwhile while(1) logging.TOC.strFileName = "c:\DAQFactoryData\TOCOutput.csv_" + formatdatetime("%m.%d.%y",systime()) + ".csv" delay(1) endwhile
AzeoTech Posted June 12, 2014 Posted June 12, 2014 Does the channel show the proper data? If so, then is the logging set running and does it include those channels?
meerooo80 Posted June 12, 2014 Author Posted June 12, 2014 Yes the channel is showing the proper data. The logging sequence is running and it does include the three channels for IC, TC and TOC.
AzeoTech Posted June 13, 2014 Posted June 13, 2014 Try just deleting the logging set and creating a new one. Its possible you changed one of the settings that is causing it to appear not working. By creating a new logging set you'll get the defaults which work. Alternatively you can post your .ctl file.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.