brunoluiz / 28335modbusslave Goto Github PK
View Code? Open in Web Editor NEW⚡️ RAW Modbus Slave (server) implementation for F28335 DSP. May work with other DSP of Delfino family.
License: Apache License 2.0
⚡️ RAW Modbus Slave (server) implementation for F28335 DSP. May work with other DSP of Delfino family.
License: Apache License 2.0
This code works on 28379D with few modifications. However, the code seems to use polling instead of DMA and/or interrupts. I will try to make a more efficient implementation that utilizes DMD and/or SCI's built-in FIFO.
I have been using this library for a couple of weeks now and it is working pretty well, I have one issue that I can not resolve and was wondering if you could give some help.
For the datahandler_readDigitalData in ModbusDataHandler.c, I'm having trouble reading just one value at a time. If I read more than one it is fine but if I try to just read one it does not seem to give me the correct value of the input register. I believe it is somewhere in this portion of the code but can't seem to pin point it. Any help would be much appreciated.
I was able to get it to work (kinda, for the first 16 variables anyways) with the following code
// MODIFIABLE: specified address values
for (idx = 0; idx < numberOfBytes; idx++) {
Uint16 coilsNum = totalDataRequested - idx*8;
Uint16 padding = idx + firstDataAddress - reg16ReturnIdx;
Uint16 content = 0;
content = *(dataPtr + padding) >> (reg16ReturnIdx*8);
if(coilsNum >= 8) {
slave->dataResponse.content[slave->dataResponse.contentIdx++] = content & 0x00FF;
} else {
Uint16 mask;
mask = ~(0xFFFF << coilsNum);
if(firstDataAddress<2)
firstDataAddress = pow(2,firstDataAddress);
else
firstDataAddress = pow(2,firstDataAddress)+2;
//slave->dataResponse.content[slave->dataResponse.contentIdx++] = content & mask;
slave->dataResponse.content[slave->dataResponse.contentIdx++] = ((*(dataPtr) & (firstDataAddress))!=0);
}
if(reg16ReturnIdx == 0) reg16ReturnIdx = 1;
else reg16ReturnIdx = 0;
}
I haven't touched this project in years and, not only, I don't work in the embedded systems field anymore. This project was implemented when I was a student research back in my university days, so it is quite cool to see so many people using it up to this day, but the time has come to archive this repository.
It might better if the TI community maintains a separate fork of this project, with support for more devices, better documentation and potentially bug fixes. I would say, this is the "wish list" of improvements:
Whoever is up for the task, please leave a comment with the fork below as I might add on the README in a later date. I will archive this repository in a few weeks, so hopefully someone will be up for the task.
This applies for both 28335ModbusSlave and 28335ModbusMaster
Obrigado 🙏
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.