cavaler / modrssim2 Goto Github PK
View Code? Open in Web Editor NEWCloned from SourceForge
License: GNU Affero General Public License v3.0
Cloned from SourceForge
License: GNU Affero General Public License v3.0
File: MODEthCommsProcessor.cpp @ line 587.
Practically the code uses count instead of byteCount that despite the name means number of bits!
The correct code is the following:
case MOD_WRITE_MULTIPLE_COILS :
// unpack into the SIM memory on WORD of sim memory for every BIT in the data
//WORD numBytes;
numBytesInReq = modMsg.**byteCount**/8; // byteCount == bit count
if (modMsg.**byteCount**%8) // if we overflow a byte
numBytesInReq++;
{
CString deb;
deb.Format("Write multiple outputs coils from %d for %d bits.\n", modMsg.address, modMsg.**byteCount**);
OutputDebugString(deb);
SockDataMessage(deb);
if (m_CommsDecodeShow) CRS232Port::WriteToFile(deb); // Added statement on 2016-12-26 by DL to save to Log file
}
numRegs = numBytesInReq * 8; // repaint X bits // 2015-01-19 Multiplied by 8 to get total BITS by DL
for (i=0;i<numBytesInReq;i++)
{
WORD bitOffset;
for (bitOffset=0;bitOffset<8;bitOffset++)
{
if ((i*8)+bitOffset < modMsg.**byteCount**) // Changed <= to only < by DL on 2018-11-27
{
if (*(BYTE*)modMsg.dataPtr & (0x01<<bitOffset))
PLCMemory.SetAt(requestMemArea, seperationOffset + modMsg.address+(i*8)+bitOffset, 1);
else
PLCMemory.SetAt(requestMemArea, seperationOffset + modMsg.address+(i*8)+bitOffset, 0);
}
}
modMsg.dataPtr++;
}
break;
Please don't ask me to create a pull request... I'm developing a modbus code for my own program and I have no time to do that.
If you want to insert the suggested changes help yourself and test them!
To verify I have used this document: Modbus_Application_Protocol_V1_1b3.pdf found on modbus.org
See you,
Bob
Please implement file record Modbus functions support.
I've toyed with a gaggle of simulators and this one is one of the better ones I have found, glad to see you have resurrected and it lives on.
One issue that I notice that could be handled better is when testing in Modbus RTU mode, if the USB cable is unplugged, the module starts chucking with the error shown in the screenshot. It would be nice if when we plugged back in, the program would recover and perhaps the log would not be spammed during the disconnect. Right-now we have to restart the program to recover.
I like that there's the option to simulate various error scenarios but it would be awesome if we could click a button to force an error to occur on demand. Currently the program allows adjusting the frequency slider but we have to wait for the simerror, it'd be nice to be able to have some more granular control over "when" these happen.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.