albaelec Posted May 28, 2012 Share Posted May 28, 2012 Hi all, I am using DAQfactory Express to communicate with a UHF transceiver. The datastream received from the UHF transmitter is shown below. Rx (10:27:20.132): \013 Rx (10:27:20.500): A28736000006553565535655356553565535655356553565535655356553565535655356553565535655356553565535655356553565535655356553565535 65535655356553565535655356553565535655356553565535 65535655356553565535655356553565535655356553565535655356553565535655356553565535655356553565535655356553565535655356553565535 65535655356553565535655356553565535652801228765535655356553565007655350511965535023036534400048005126553565535655356553565535 655356553565535655356553565535655356553565535655356553565535655356553565535655356553565535655356553565535655356553565535655 35655356553565535655356553565535655356553565535655356553565535655356553565535655356553565535 D01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 My requirement is to parse 5 characters just after alphabet 'A'. I have written a small script in the on-receive section of DAQfactory to parse this data. if (strIn =="A") private string DataIn = Read(5) Channel.AddValue(strDevice,0, "dinput",0, StrToDouble(DataIn)) Endif The problem I am experiencing is that this code doesn't show the immediate 5 characters after the alpahbet A insead it always displays 53565. Can anyone advise me on this problem. Is it due to ASCII value of A being 65? Many thanks. Link to comment Share on other sites More sharing options...
AzeoTech Posted May 29, 2012 Share Posted May 29, 2012 I'm assuming you are trying to use a protocol. Do it in a sequence instead. Also, I'm assuming from the look of it that there is always a carriage return before the A. In that case, the sequence would look something like this: device.mydevice.purge()while(1) private string datain = device.mydevice.readuntil(13) if (left(datain,1) == "A") myChannel.AddValue(strToDouble(mid(datain,1,5))) endifendwhile[/CODE] Link to comment Share on other sites More sharing options...
tigerlibin Posted December 7, 2012 Share Posted December 7, 2012 Hi Guru, I am a new user of DAQ factory and I am experiencing the same problem. I copied the code into my sequence and "began sequence" but there is an alert which says "C1000 channel or function not found: UHF Line 3 - Uncaught error in sequence UHF". Here, UHF is my sequency name. I am wondering is there some variable names that I need to change to suit my case ? Thanks in advance! Link to comment Share on other sites More sharing options...
AzeoTech Posted December 7, 2012 Share Posted December 7, 2012 You have to create a serial device and either call it "myDevice", or change line 3 where it says "myDevice" to say whatever you called your device. Same thing with line 5 and myChannel. In these forums I pretty consistantly use myXXXX when I want to refer to a channel, sequence, device or some other object that you, as the developer might name, but that I don't know the name of. The intention is that you would replace any myXXXX's with your own names. Link to comment Share on other sites More sharing options...
tigerlibin Posted December 11, 2012 Share Posted December 11, 2012 Thanks Guru. I am sorry that I was not in the office yesterday and cannot reply on time. Today, I modified the code to the followings. device.UHF.purge() while(1) private string datain = device.UHF.readuntil(13) if (left(datain,1) == "A") myChannel.AddValue(strToDouble(mid(datain,1,5))) endif endwhile "UHF" is the device name which I set in my Ethernet/Serial Device. I created a new channel with the name "myChannel", device type "UHF", Chn # is 0. But when I began the sequence, but this time I have got a slightly different error message which is "C1136 Timeout: UHF Line3- uncaught error in sequence UHF". Can you please help figure out where is wrong and how to solve it? Many thanks in advance Link to comment Share on other sites More sharing options...
tigerlibin Posted December 11, 2012 Share Posted December 11, 2012 Hi Guru again. The line 3 problem has been solved. But there is another problem in line 4. Here is the modified code. device.UHF.purge() while(1) private string DataIn = device.UHF.ReadUntil(13) if (Left(DataIn,1) == "A") myChannel.AddValue(StrToDouble(mid(DataIn,1,5))) endif endwhile The error message is: C1086 One of the parameters was empty: UHF Line 4 - Uncaught error in sequence UHF. From the message, I do not know why there is one of the parameters is empty. Without "if" function, the code is working, and I think variable "DataIn" can read something. Thanks, Link to comment Share on other sites More sharing options...
AzeoTech Posted December 11, 2012 Share Posted December 11, 2012 Datain could be empty if the next character in the UHF port buffer is 13. Try adding: ? datain right after the readuntil() line. That will display its contents in the command/alert window. My guess is that you'll see a blank line right before the error message. Link to comment Share on other sites More sharing options...
roshancheluva Posted July 17, 2013 Share Posted July 17, 2013 Hi all, i am new to daq factory,i want display the readings from two sensors at a time. in daq factory monitor i am getting two reading separated by comma.i have to display that values using variable value command.please help me.' i have created two channels in that i have mentioned as A to D. 1.Egr_channel 2.new channel in the expression of variable value i have given as egr_channel[0] anf newchannel[0] i am reading data from a microcontroller the main aim is i have display two readings of sensor on two variable value option. i dont know to do it,as i am new to it please help me asap. Thanks in advance egr.ctl Link to comment Share on other sites More sharing options...
AzeoTech Posted July 18, 2013 Share Posted July 18, 2013 Can you post a screen shot of your monitor window so I can see the exact format of the data stream? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.