basen Posted November 8, 2009 Share Posted November 8, 2009 Trying to connect to a Bayrol (water pool dosing device) with mix-success. Using almost exactly your example form SerialGuide to create new protocol (see below) I am trying to read a sequence of: B;3;653;650;800;\x1A B;3; then 3 numbers folowed by char(26) While I could read channel #0 from my device with no problem channels #1 and #2 return no value. Regards, Pawel if (Channel != 0) return(NULL) endif private string datain = Poll("B;3;"+Chr(26),26) Channel.AddValue(strDevice,0,"GetData",1,StrToDouble(Parse(datain,3,";"))) Channel.AddValue(strDevice,0,"GetData",2,StrToDouble(Parse(datain,4,";"))) return(StrToDouble(Parse(datain,2,";"))) Link to comment Share on other sites More sharing options...
AzeoTech Posted November 9, 2009 Share Posted November 9, 2009 Just to verify, your other channels have the same device type as the one triggering this polling, D# = 0, I/O type = "GetData" (case sensitive) and channel #'s are 1 and 2? There was a bug at some point having to do with "Channel". Its a parameter passed into the sequence, so doing Channel.AddValue() is trying to do this to the private parameter, not the global object. I think the latest docs have this updated. Because of this, you have to reference Channel with its connection: Local.Channel.AddValue(....) Link to comment Share on other sites More sharing options...
basen Posted November 9, 2009 Author Share Posted November 9, 2009 Sir, thanks a million! After adding Local it works now. If this is so good I dare to ask for an advise .... Bayrol device accepts a couple commands, like: B;3;\x!A to read chlor dosing parameters N:3;\x1A to read pH dosing parateters U;3;\x1A to read time of Bayrol computer real time clock T;3;\x1A to read temperature control parameters .... few more read-type commands and a few more write-type commands I am trying to spy using serial monitor (Germans rather do not will to disclose any tech data) Grateful for any protocol definition advise or maybe is this a kind of known protocol. Regards, Pawel Link to comment Share on other sites More sharing options...
AzeoTech Posted November 10, 2009 Share Posted November 10, 2009 Its not a known protocol I've ever seen, but still real easy to implement. Just create more I/O types just like you did for those first items. But it looks like in these cases, you don't need the AddValue() lines since you are just getting one value. Link to comment Share on other sites More sharing options...
basen Posted November 10, 2009 Author Share Posted November 10, 2009 Thank you. One more thing, please. I would like to use device number (D#) in my new protocol becasuse Bayrol has RS485 interface (but no Modbus protocol here). In command B;3;\x1A number 3 means RS485 channel #3. What is the way make it in my code? How do I pass the device number (D#) to the code of I/O Type? Link to comment Share on other sites More sharing options...
AzeoTech Posted November 10, 2009 Share Posted November 10, 2009 It comes into the function as a parameter called "DeviceNumber". Please see the users guide section 15.2.2, "creating your own device". Creating your own protocol is basically the same. You can then read section 16.8 to find out what is different. Link to comment Share on other sites More sharing options...
basen Posted November 10, 2009 Author Share Posted November 10, 2009 Thank you. What is the way to pass device number (D#) to the code of I/O Type ? As command B;3;\x1A really sends letter B to device #3 of Bayrol RS485 interface (but not Modbus protocol here) I would like to make the protocol to be useful after I change the device number. Best regards, Pawel Link to comment Share on other sites More sharing options...
AzeoTech Posted November 10, 2009 Share Posted November 10, 2009 That is what I just said. Its passed as the private variable "DeviceNumber" which you can use in your I/O type code. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.