28335ModbusMaster icon indicating copy to clipboard operation
28335ModbusMaster copied to clipboard

Multiple Variables

Open rocksolidsr opened this issue 9 years ago • 2 comments

Hello,

I've been using your ModbusSlave implementation and it was been working very well. I really appreciate the work you have done.

I'm trying to get your ModbusMaster implementation working and I have a couple of questions if you don't mind: 1.) I was able to receive the demo request you had in the code

 // Implementing a demo request using mb.requestHandler
       registerContents[0] = 0x0001;
        registerContents[1] = 0xFFFF;
        mb.requestHandler.slaveAddress = 0x01;
        mb.requestHandler.functionCode = MB_FUNC_WRITE_NREGISTERS;
        mb.requestHandler.firstAddr    = 0x02;
        mb.requestHandler.totalData    = 2;
        mb.requestHandler.content      = registerContents;
        mb.requestHandler.generate(self);

However, when I change the firstAddr to 0x00 it doesn't change where the data is actually written too, am I changing the right parameter?

2.) My biggest question is how do I create more variables to either write too or read from, like in the ModbusSlave you would create additional variables in the ModbusDataMap.h and then access them via mb.coills.variableName or mb.inputRegisters.variableName, etc. But in the project there was no ModbusDataMap.h so I used the same one I had for ModbusSlave but mb.coils, mb.inputs, mb.inputRegisters, and mb.HoldingRegisters doesn't exist.

Any help would be greatly appreciated.

Thanks, Shane

rocksolidsr avatar Jul 20 '15 18:07 rocksolidsr

I fixed the problem with address. It was just an idiot bug which I fixed changing the name of vars on requestHandler.generate function.

The DataMap is one of my ideas to make the process of updating variables easier, but I think I will not have time to implement the DataMap into this project because all of this was created while I am at CERTI Foundation. Next week I will quit here and there is a lot of tasks in-hold now. Sadly the actual code is satisfactory for my managers and I have to implement other things in this time.

I could do that in my spare time but the main problem, that will make me "freeze" this project, is that I will not have any DSPs to test my code anymore (all of them are from CERTI). However, if you manage to send me a DSP and USB-Serial adapter I could try to create these features (and improve the project).

brunoluiz avatar Jul 22 '15 16:07 brunoluiz

Bruno,

I could probably send you a DSP but you said you would also need a USB serial adapter which I do not have. Also would you need a JTAG emulator? If I were able to get you a DSP how quickly do you think you would be able to create the DataMap?

-Shane

On Wed, Jul 22, 2015 at 12:57 PM, Bruno Luiz Silva <[email protected]

wrote:

I fixed the problem with address. It was just an idiot bug which I fixed changing the name of vars on requestHandler.generate function.

The DataMap is one of my ideas to make the process of updating variables easier, but I think I will not have time to implement the DataMap into this project because all of this was created while I am at CERTI Foundation. Next week I will quit here and there is a lot of tasks in-hold now. Sadly the actual code is satisfactory for my managers and I have to implement other things in this time.

I could do that in my spare time but the main problem, that will make me "freeze" this project, is that I will not have any DSPs to test my code anymore (all of them are from CERTI). However, if you manage to send me a DSP and USB-Serial adapter I could try to create these features (and improve the project).

— Reply to this email directly or view it on GitHub https://github.com/brnluiz/28335ModbusMaster/issues/1#issuecomment-123791532 .

rocksolidsr avatar Jul 27 '15 13:07 rocksolidsr