Forum Replies Created
-
AuthorPosts
-
manjey73
ParticipantThe formula does not cause an error on the 5th version, but always sends 0 for some reason
manjey73
Participantpublic double NewFreq() { byte[] freq = BitConverter.GetBytes((uint)Cmd*100); byte[] res = new byte[] { 0x00, 0x01, freq[1], freq[0], 0x00, 0x00, 0x00, 0x00 }; return BitConverter.ToDouble(res, 0); }
Return the command type to Standard and try the following formula
It may be necessary to play with the location of bytes in the array
byte[] res = new byte[] {0x00, 0x00, 0x00, 0x00, 0x00, 0x01, freq[1], freq[0] };
But in theory, the first option in the formula should workmanjey73
ParticipantYou would change version 5 to version 6, some things are much simpler there
If I’m not mistaken, on the 5th version in Binary mode, when entering HEX, a byte array is returned, and this should be taken into account in the formula.
manjey73
ParticipantWhen entering the value 30 in binary form, it is entered as a string and BitConverter cannot be applied here.
manjey73
ParticipantFor the 5th version, the formula is likely to be different, since you are forced to enter a HEX value.
The 6th version is somewhat more flexible in terms of formula implementations
manjey73
ParticipantOops, do you have Scada version 5? I don’t know if it’s possible to do this on the 5th version, I haven’t tried it before.
manjey73
ParticipantMikhail, a person wants to drive just a frequency number, but at the same time he needs a command to be added to the byte array that allows changing this frequency. The formula that I have given is working, it is simply necessary to provide a command in the device template to get it. We did this with recording time in several registers.
manjey73
ParticipantIs this your Modbus device ?
manjey73
Participant| 31.07.2023 08:59:05 | Code=freq, Data=00010BB8 |
Enter 30 in Web.
Although no, it seems to be enough, I entered 30 into the Web and received the following data in the sent command.manjey73
ParticipantYes, there is another nuance, in the formula it is necessary to additionally convert the number to HEX. We need to think about how to do this… Just using BitConverter is not enough for this
manjey73
ParticipantFor me, the formula does not cause errors during compilation. And the result of sending from the Web is shown below. It may be necessary to rearrange the bytes in the formula. Well, configure the command in the Modbus template as multiple for several registers in addition to the other channels.
manjey73
Participantpublic byte[] NewFreq()
{
byte[] freq = BitConverter.GetBytes)(uint)Cmd*100);
return new byte[] { 0x00, 0x01, freq[1], freq[0])
}I haven’t checked, but something like this
manjey73
ParticipantYou need to use the formula in the control channel that will send the generated CmdData
manjey73
ParticipantI strongly doubt that there will be DCOM support in the Windows 10 version for ARM
manjey73
ParticipantFor commands, Cmd (command value) must be used, and Cnl (channel value) is used for input channels
-
AuthorPosts