Answers in the forums created
-
AuthorPost
-
February 8, 2021 at 5: 58 pm in response to: Modbus RTU communication with SDM120 Energy meter #58986tommas.cavalliniParticipant
First of all, I apologize for the confusion: I have to read both the EnergyMeter and the solenoid valves, on the latter I must also write: since they both communicate in RTU I thought I could ask directly here without having to open another topic.
Coming to us, I did not understand the proposed solution: I thought of separating the reading and writing phase by not connecting the FBs in cascade. In fact, reading must be continuous while writing occurs only when e se I want to change some parameters.
February 8, 2021 at 11: 33 am in response to: Modbus RTU communication with SDM120 Energy meter #58983tommas.cavalliniParticipantPerfect, now my problem lies in the time management of reading and writing of ten solenoid valves.
If for reading it is sufficient to associate the program to the Back task in such a way as to be performed periodically, the writing instead I would like to be able to perform it only following a particular condition: I have seen that LogicLab does not provide event tasks, so how could I do ?
tommas.cavalliniParticipantPerfect, I have tried everything as you explained to me and it works, so thank you very much.
But now I have another problem: I was asked to delay the reading in Modbus in order to perform one reading per minute. To do this I thought of acting on the Delay voice: is it correct to put a delay of 60 for my end or would it be better to put an eTON before Enable in order to delay with the timer?
In case I go to modify the Delay (putting 60), having two modbusMasters in cascade, in the Delay item of the second FB I should put 61 (60 of the previous + 1 delay between the two readings) or I just need to insert the delay between the two readings (1 sec) and in the first let 60?
tommas.cavalliniParticipantI tell you right away that unfortunately the reading of the values from the datataker is not successful if I use VarSwap (I thought of using this at the beginning, but a very high number comes out) while if I use the FB BEArrayToVar it works and gives me the value read correctly.
For the rest, 36 of the 40 are in consecutive registers, so for these I can execute a single reading command (specifying the first address from which to start under Address and under Points of the ModbusMaster how much data I want to read, in my case 36 * 2, 72). In the ModbusMaster buffer then I will put an array that is able to contain 36 data (called ArrayA to be clear), this array will then be connected to BEArrayToVar at the entry Source and Destination i will put another array (ArrayB) which will contain all values read correctly, right?
My question is: automatically, after each reading, the read data goes into ArrayA, it is executed BEArrayToVar and is stored in ArrayB. At the next reading cycle, the second data read goes to ArrayA immediately after the previous one automatically, and then goes to ArrayB stored in a row, right?
tommas.cavalliniParticipantI made a Modbus TCP / IP communication with a datataker using the SysTCPClient and ModbusMaster FBs, at the end of which, once the data was received in IEE754, I made a conversion with the BEArrayToVar FB.
At this point, the problem is that I have to read 40 values from the same device and save each of them in a variable of its own: what could I do?
I have also seen the FB recommended by her, the ACModbus, but the problem is that once I have read these variables I must necessarily carry out the conversion with BEArrayToVar for each of them individually and instantiate a variable for each of the data, so I am afraid that I cannot use it.
What do you recommend I do to solve the problem?
January 28, 2021 at 11: 21 am in response to: Modbus RTU communication with SDM120 Energy meter #58894tommas.cavalliniParticipantNow the problem has arisen that through ModBus RTU connection I also want to write data. So I wondered: if for reading we used the varSwap FB to convert the values to REAL, how can I do it for writing?
I thought I would enter the values to be written in the Buffer item of the ModbusMaster FB, but I think I understood that I cannot write a REAL value but a value in the IEE754 standard, right?
How do I then perform the VarSwap reverse conversion?
January 15, 2021 at 6: 14 pm in response to: Modbus RTU communication with SDM120 Energy meter #58808tommas.cavalliniParticipantI tried the FB method ModbusMaster cascade and it works, thanks a lot for the help!
His videos and his explanations were fundamental especially because I have just entered the world of PLCs, I am really grateful to him. In case I have other doubts, I will post on the forum that it is very well done and the answers are quicker than I expected.
January 15, 2021 at 10: 36 am in response to: Modbus RTU communication with SDM120 Energy meter #58805tommas.cavalliniParticipantHello, in the meantime, thank you very much for your attention. In my project I used the SysSerialPort and ModbusMaster and VarSwap FBs.
I then tried to connect another ModbusMaster FB (which identifies the second SDM120 having node 2) using the same FB for the serial port. In the EN port of the second ModbusMaster I added an eTON with a time of 200ms, but I can always read only the first one (connected to the first ModbusMaster FB). I also tried to separate everything into two different programs by associating them with different tasks, but the result doesn't change, on the contrary, it doesn't even read the first one anymore.
How can I solve? Thanks again in advance.
-
AuthorPost