Modbus/include/ModbusCommonStructs.cin
aligned structs Modbus/modbus.dbc Included Ethernet_IL.dll
This commit is contained in:
parent
2ed521dc48
commit
c43e3cef40
6 changed files with 37 additions and 112 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
void bin_to_strhex(byte bin[], char result[])
|
||||
{
|
||||
char hex_str[17] = "0123456789ABCDEF";
|
||||
char hex_str[17]= "0123456789ABCDEF";
|
||||
word i;
|
||||
word binsz;
|
||||
|
||||
|
@ -28,7 +28,7 @@ void bin_to_strhex(byte bin[], char result[])
|
|||
|
||||
void hbin_to_strhex(byte bin[], char result[])
|
||||
{
|
||||
char hex_str[17] = "0123456789ABCDEF";
|
||||
char hex_str[17]= "0123456789ABCDEF";
|
||||
word i;
|
||||
word binsz;
|
||||
|
||||
|
@ -49,33 +49,4 @@ void hbin_to_strhex(byte bin[], char result[])
|
|||
result[38] = '.';
|
||||
}
|
||||
result[binsz * 2 - 1] = 0;
|
||||
}
|
||||
|
||||
void dbin_to_strhex(word bin[], char result[])
|
||||
{
|
||||
char hex_str[17] = "0123456789ABCDEF";
|
||||
word i;
|
||||
word binsz;
|
||||
byte offset;
|
||||
|
||||
binsz = elCount(bin);
|
||||
if (binsz > 20)
|
||||
binsz = 20;
|
||||
|
||||
for (i = 0; i < binsz; i++)
|
||||
{
|
||||
result[i * 5 + 0] = hex_str[(bin[i] >> 12) & 0x0F];
|
||||
result[i * 5 + 1] = hex_str[(bin[i] >> 8) & 0x0F];
|
||||
result[i * 5 + 2] = hex_str[(bin[i] >> 4) & 0x0F];
|
||||
result[i * 5 + 3] = hex_str[(bin[i] ) & 0x0F];
|
||||
result[i * 5 + 4] = ' ';
|
||||
}
|
||||
|
||||
if (elCount(bin) > 20) // trailing "..."
|
||||
{
|
||||
result[96] = '.';
|
||||
result[97] = '.';
|
||||
result[98] = '.';
|
||||
}
|
||||
result[(byte)(binsz * 2.5) - 1] = 0;
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
variables
|
||||
{
|
||||
// A normal Modbus Application Header. Every Modbus Packet begins with these 7 (+FuncCode) Bytes
|
||||
_align(1) struct ModbusApHeader
|
||||
struct ModbusApHeader
|
||||
{
|
||||
word TxID;
|
||||
word Protocol;
|
||||
|
@ -11,21 +11,21 @@ variables
|
|||
byte FuncCode;
|
||||
};
|
||||
// Read Data from the host. We only need the start address and the number of bits/registers we want to read
|
||||
_align(1) struct ModbusReqRead
|
||||
struct ModbusReqRead
|
||||
{
|
||||
struct ModbusApHeader Header;
|
||||
word Address;
|
||||
word Count;
|
||||
};
|
||||
// Write a single value to a bit/register
|
||||
_align(1) struct ModbusReqWriteSingle
|
||||
struct ModbusReqWriteSingle
|
||||
{
|
||||
struct ModbusApHeader Header;
|
||||
word Address;
|
||||
word Value;
|
||||
};
|
||||
// Write several values to a bit/register starting with Address
|
||||
_align(1) struct ModbusReqWriteBits
|
||||
struct ModbusReqWriteBits
|
||||
{
|
||||
struct ModbusApHeader Header;
|
||||
word Address;
|
||||
|
@ -34,89 +34,41 @@ variables
|
|||
byte Data[246]; // Max length: 1968 bits
|
||||
};
|
||||
// Write several values to bits starting with Address
|
||||
_align(1) struct ModbusReqWriteRegisters
|
||||
struct ModbusReqWriteRegisters
|
||||
{
|
||||
struct ModbusApHeader Header;
|
||||
word Address;
|
||||
word Count;
|
||||
byte ByteCount;
|
||||
word Data[123]; // Max length: 123 registers
|
||||
int Data[123]; // Max length: 123 registers
|
||||
};
|
||||
// Write AND and OR masks to a holding register
|
||||
_align(1) struct ModbusReqWriteMasks
|
||||
{
|
||||
struct ModbusApHeader Header;
|
||||
word Address;
|
||||
word And;
|
||||
word Or;
|
||||
};
|
||||
// Read and write multiple registers
|
||||
_align(1) struct ModbusReqReadWriteRegisters
|
||||
{
|
||||
struct ModbusApHeader Header;
|
||||
word ReadAddress;
|
||||
word ReadCount;
|
||||
word WriteAddress;
|
||||
word WriteCount;
|
||||
byte ByteCount;
|
||||
word Data[121]; // Max length: 123-2 registers
|
||||
};
|
||||
|
||||
|
||||
// Receive several bit values
|
||||
_align(1) struct ModbusResReceiveBits
|
||||
struct ModbusResReceiveBits
|
||||
{
|
||||
struct ModbusApHeader Header;
|
||||
byte ByteCount;
|
||||
byte Data[250]; // Max length: 2000 bits
|
||||
};
|
||||
// Receive several register values
|
||||
_align(1) struct ModbusResReceiveRegisters
|
||||
struct ModbusResReceiveRegisters
|
||||
{
|
||||
struct ModbusApHeader Header;
|
||||
byte ByteCount;
|
||||
word Data[125]; // Max length: 125 registers
|
||||
int Data[125]; // Max length: 125 registers
|
||||
};
|
||||
// Confirm the write of a single bit/register
|
||||
_align(1) struct ModbusResConfirmSingle
|
||||
struct ModbusResConfirmSingle
|
||||
{
|
||||
struct ModbusApHeader Header;
|
||||
word Address;
|
||||
int Value;
|
||||
};
|
||||
// Confirm the write of several bits/registers
|
||||
_align(1) struct ModbusResConfirmMultiple
|
||||
struct ModbusResConfirmMultiple
|
||||
{
|
||||
struct ModbusApHeader Header;
|
||||
word Address;
|
||||
word Count;
|
||||
};
|
||||
// Confirm the write of AND and OR mask
|
||||
_align(1) struct ModbusResConfirmMasks
|
||||
{
|
||||
struct ModbusApHeader Header;
|
||||
word Address;
|
||||
word And;
|
||||
word Or;
|
||||
};
|
||||
|
||||
|
||||
|
||||
enum ModbusRequestError
|
||||
{
|
||||
Exception,
|
||||
Timeout
|
||||
};
|
||||
enum ModbusException
|
||||
{
|
||||
None = 0x00,
|
||||
IllegalFuncCode = 0x01,
|
||||
IllegalDataAddress = 0x02,
|
||||
IllegalDataValue = 0x03,
|
||||
ServerFailure = 0x04,
|
||||
Acknowledge = 0x05,
|
||||
ServerBusy = 0x06,
|
||||
GatewayPathsNA = 0x0A,
|
||||
TargetOffline = 0x0B
|
||||
};
|
||||
}
|
|
@ -29,7 +29,7 @@ dword SetupIp(char Local_IP[])
|
|||
long error;
|
||||
|
||||
adapterCount = IpGetAdapterCount();
|
||||
adapterIndex = @sysvar::Config::TcpIp::AdapterIndex;
|
||||
adapterIndex = @sysvar::TCPIP::AdapterIndex;
|
||||
|
||||
switch (adapterCount)
|
||||
{
|
||||
|
|
|
@ -4982,7 +4982,7 @@ VSimulinkModelViewerConfiguration 7 Begin_Of_Object
|
|||
End_Of_Object VSimulinkModelViewerConfiguration 7
|
||||
1
|
||||
0
|
||||
2556482575
|
||||
3696050849
|
||||
0
|
||||
NodeSignalPanelBustypeCount 0
|
||||
End_Of_Object VSimulationNode 6
|
||||
|
|
|
@ -40,8 +40,10 @@ BU_: Wago_3
|
|||
|
||||
EV_ Wago_3_IP: 0 [0|0] "" 0 1 DUMMY_NODE_VECTOR8001 Vector__XXX;
|
||||
|
||||
BA_DEF_ BU_ "NodeLayerModules" STRING ;
|
||||
BA_DEF_ "DBName" STRING ;
|
||||
BA_DEF_ "BusType" STRING ;
|
||||
BA_DEF_DEF_ "NodeLayerModules" "Ethernet_IL.DLL";
|
||||
BA_DEF_DEF_ "DBName" "";
|
||||
BA_DEF_DEF_ "BusType" "Ethernet";
|
||||
BA_ "BusType" "Ethernet";
|
||||
|
|
|
@ -11,13 +11,13 @@ COLUMNWIDTHS=125,125,
|
|||
[View_VehicleNetworks]
|
||||
HIDDEN=3,5,
|
||||
ORDER=0,1,2,3,4,
|
||||
DEFINITIONS=1,2,
|
||||
DEFINITIONS=2,3,
|
||||
COLUMNWIDTHS=125,125,100,100,150,100,100,
|
||||
[View_VehicleNetwork]
|
||||
HIDDEN=
|
||||
ORDER=0,1,2,3,4,
|
||||
DEFINITIONS=
|
||||
COLUMNWIDTHS=125,125,100,125,150,
|
||||
ORDER=0,1,2,3,4,5,
|
||||
DEFINITIONS=1,
|
||||
COLUMNWIDTHS=125,125,100,125,150,100,
|
||||
[View_VehicleNetworkTxMessages]
|
||||
HIDDEN=
|
||||
ORDER=0,1,2,3,4,5,6,7,8,
|
||||
|
@ -30,9 +30,9 @@ DEFINITIONS=
|
|||
COLUMNWIDTHS=125,125,100,50,100,50,100,100,100,50,50,50,50,100,100,150,
|
||||
[View_VehicleControlUnit]
|
||||
HIDDEN=
|
||||
ORDER=0,1,2,3,4,
|
||||
DEFINITIONS=
|
||||
COLUMNWIDTHS=125,125,100,125,150,
|
||||
ORDER=0,1,2,3,4,5,
|
||||
DEFINITIONS=1,
|
||||
COLUMNWIDTHS=125,125,100,125,150,100,
|
||||
[View_VehicleGateways]
|
||||
HIDDEN=
|
||||
ORDER=0,1,2,
|
||||
|
@ -46,13 +46,13 @@ COLUMNWIDTHS=125,125,125,125,125,125,125,
|
|||
[View_Networks]
|
||||
HIDDEN=2,4,
|
||||
ORDER=0,1,2,3,
|
||||
DEFINITIONS=1,2,
|
||||
DEFINITIONS=2,3,
|
||||
COLUMNWIDTHS=125,100,100,150,100,100,
|
||||
[View_Network]
|
||||
HIDDEN=
|
||||
ORDER=0,1,2,3,
|
||||
DEFINITIONS=
|
||||
COLUMNWIDTHS=125,125,100,150,
|
||||
ORDER=0,1,2,3,4,
|
||||
DEFINITIONS=1,
|
||||
COLUMNWIDTHS=125,125,100,150,100,
|
||||
[View_NetworkTxMessages]
|
||||
HIDDEN=
|
||||
ORDER=0,1,2,3,4,5,6,7,8,
|
||||
|
@ -65,9 +65,9 @@ DEFINITIONS=
|
|||
COLUMNWIDTHS=125,125,100,50,100,50,100,100,100,50,50,50,50,100,100,150,
|
||||
[View_NetworkNodeGroup]
|
||||
HIDDEN=
|
||||
ORDER=0,1,2,
|
||||
DEFINITIONS=
|
||||
COLUMNWIDTHS=125,100,150,
|
||||
ORDER=0,1,2,3,
|
||||
DEFINITIONS=1,
|
||||
COLUMNWIDTHS=125,100,150,100,
|
||||
[View_Ecus]
|
||||
HIDDEN=
|
||||
ORDER=0,1,
|
||||
|
@ -75,9 +75,9 @@ DEFINITIONS=
|
|||
COLUMNWIDTHS=125,150,
|
||||
[View_Ecu]
|
||||
HIDDEN=
|
||||
ORDER=0,1,2,3,
|
||||
DEFINITIONS=
|
||||
COLUMNWIDTHS=125,125,100,150,
|
||||
ORDER=0,1,2,3,4,
|
||||
DEFINITIONS=1,
|
||||
COLUMNWIDTHS=125,125,100,150,100,
|
||||
[View_EnvVars]
|
||||
HIDDEN=
|
||||
ORDER=0,1,2,3,4,5,6,7,8,9,
|
||||
|
@ -100,9 +100,9 @@ DEFINITIONS=
|
|||
COLUMNWIDTHS=125,125,55,150,
|
||||
[View_Nodes]
|
||||
HIDDEN=
|
||||
ORDER=0,1,2,
|
||||
DEFINITIONS=
|
||||
COLUMNWIDTHS=125,100,150,
|
||||
ORDER=0,1,2,3,
|
||||
DEFINITIONS=1,
|
||||
COLUMNWIDTHS=125,100,150,100,
|
||||
[View_Node]
|
||||
HIDDEN=
|
||||
ORDER=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,
|
||||
|
|
Loading…
Reference in a new issue