Forum Home › Forums › Communicating with Devices › Modbus › Problem in Sending Modbus (Command) Float32 data
- This topic has 21 replies, 4 voices, and was last updated 1 year, 2 months ago by
Mikhail.
-
AuthorPosts
-
June 28, 2017 at 4:55 am #2294
raazsi
ParticipantThanks, Manjey n Mikhail… It really helped. Now that I got to know that we can write our own script in RapidScada. It’s really helpful.
Meanwhile, i tried a bit on my own for generating reset output. I wrote a script wherein, the output is 1 for a specified duration and then it gets to zero. But I am facing a difficulty.
The input parameter for the function is a coil channel read via Modbus from the Modbus device. Is there any way to set the values of output/Input channel dynamically through a code??? I tried with CnlValSet(Int Cnl, Double Value) & SetVal(Int Cnl, Double Value) But I am getting an error with it…
Line 496, column 1: error CS0103: The name ‘CnlValSet’ does not exist in the current context
Below is the snippet of the code I am using. The algorithm which I intend to use is that if the value of coil register is 1, then the function will return value of 1 for 5 seconds and then it will return zero. Then I’ll make the value of coil register to zero inside the function itself to reset it.
bool Getreset (bool a,int InCnl )
{
// bool a is the value of coil registerint result;
DateTime now = DateTime.Now;
DateTime now2 = now.AddSeconds(5);
if (a==Convert.ToBoolean(1))
{
do
{
result = DateTime.Compare(DateTime.Now, now2);
if (result < 0)
return (Convert.ToBoolean(1));
else
return (Convert.ToBoolean(0));
} while (result < 0);
return (Convert.ToBoolean(0));
CnlValSet(Incnl,0);
}
else
{
return(a);
}
}June 28, 2017 at 5:06 am #2296Mikhail
ModeratorYou should use SetVal or SetData according to http://doc.rapidscada.net/content/en/software-configuration/using-formulas.html
There is no function named CnlValSet unless you define it by yourself.June 24, 2024 at 2:14 am #14751Octavio F
ParticipantHello
great interaction that have helped me a lot.
i have a similar issue, trying to read uint32 type of data.
| 39 | EPAImp | EPAImp | 200000h | 2000 |
Tha value 200000h should be 239.6
Thanks for helping
June 24, 2024 at 5:41 am #14752manjey73
Participant@octavio-f I use this converter to determine the permutation
https://www.scadacore.com/tools/programming-calculators/online-hex-converter/
See Float – Mid-Big Endian (BADC) In theory, you need to specify a byte permutation for your case = 1032
June 24, 2024 at 5:43 am #14753manjey73
ParticipantAnd possibly with subsequent multiplication by 100 in the Cnl*100 channel formula
June 24, 2024 at 12:33 pm #14768Octavio F
ParticipantHello
thanks for the response.
Let me try to be more specific
The Device sends UInt32, but Rapid Scada wont read it, but with ModbusPoll, i can read it without problem.
The things is how can i configure the template in rapid scada to get the actual value of the reading.
thanks again!
June 25, 2024 at 10:35 am #14771Mikhail
ModeratorHello,
What data packet do you receive?
Please provide screenshots and logs. -
AuthorPosts
- You must be logged in to reply to this topic.