Forum Home › Forums › Understanding the Software › Convert decimal to hexadecimal from web browser
- This topic has 41 replies, 4 voices, and was last updated 2 years ago by
kcks66.
-
AuthorPosts
-
July 28, 2023 at 9:18 am #13073
kcks66
ParticipantHi Mikhail,
I connected an inverter and I want to read its running output frequency and write command from web browser to change its output frequency.
I managed to read its running output frequency. I faced challenge when I want to write command into the inverter from web browser.
The inverter accept hexadecimal command to run with prefer output frequency. Below is the screenshot from communicator device which I could write command successfully in hexadecimal format.
0001 refer to run
0BB8 refer to decimal 3000 (30Hz)I could use web browser to enter 00010BB8 and write successfully into the inverter.
I wish to enter decimal number example 30 in web browser and how to convert the 30 decimal number from web browser into 00010BB8 hexadecimal at the output channel before send to the inverter?
Looking forward from your advice. Thank you.
July 28, 2023 at 1:30 pm #13079manjey73
ParticipantYou need to use the formula in the control channel that will send the generated CmdData
July 28, 2023 at 1:46 pm #13080kcks66
ParticipantHi manjey73,
You meant write a scripts to convert decimal numbers to hexadecimal numbers in the output channel?
I am weak in scripting. Any idea how to do it?
Thank you.
July 28, 2023 at 2:08 pm #13081Mikhail
ModeratorHi,
What is the current formula of the output channel?July 28, 2023 at 2:42 pm #13085kcks66
ParticipantHi Mikhail,
Currently output channel has no any formula.
July 28, 2023 at 8:10 pm #13086manjey73
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
July 30, 2023 at 12:30 pm #13097zzz
Participantfrom webbrowers to VFD
sounds a bad idea, there should be at least a middle agent to validate the data or access control etc…July 31, 2023 at 5:08 am #13098kcks66
ParticipantHi manjey73,
I got error message from SCADA Server:
Error calculating standard command value for the output channel 20032: Unable to cast object of type ‘System.Byte[]’ to type ‘System.IConvertible’.
Command is canceledMy output channel formula:
public byte[] NewFreq()
{
byte[] freq = BitConverter.GetBytes((uint)Cmd*100);
return new byte[] { 0x00, 0x01, freq[1], freq[0]};
}Pls advice and thank you.
July 31, 2023 at 5:55 am #13099manjey73
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.
July 31, 2023 at 5:58 am #13100manjey73
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
July 31, 2023 at 6:00 am #13101manjey73
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.July 31, 2023 at 6:01 am #13102manjey73
ParticipantIs this your Modbus device ?
July 31, 2023 at 6:22 am #13105kcks66
ParticipantHi manjey73,
| 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.YES, this is what I need.
I need to start from beginning step by step follow your instructions.
The formula below is correct?
public byte[] NewFreq()
{
byte[] freq = BitConverter.GetBytes((uint)Cmd*100);
return new byte[] {0x00, 0x01, freq[1], freq[0]};
}July 31, 2023 at 6:28 am #13106kcks66
ParticipantHi manjey73,
Next is my device template:
Follow by my output channel:
July 31, 2023 at 6:34 am #13107kcks66
ParticipantHi manjey73,
I entered 30 in web browser:
But error message occur:
What have I missed out?
-
AuthorPosts
- You must be logged in to reply to this topic.