New Protocol, need help


basen

Recommended Posts

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

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

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

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

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

Archived

This topic is now archived and is closed to further replies.