Forum Home › Forums › Understanding the Software › Reading event log from modbus device
- This topic has 14 replies, 3 voices, and was last updated 6 days, 20 hours ago by
Mikhail.
-
AuthorPosts
-
June 30, 2025 at 3:11 pm #16545
oley
ParticipantHello,
I have a modbus device connected that has an event log.
Before reading events, I have to read the register of the number of new events.
This freezes the current event list so that new events occurring during the readout will not cause the buffer to move.
It is possible to read both registers independently, or read both registers at once.Register 0x0501 -Number of new events
Register 0x0502 -Number of all eventsReading events can be freely divided (reading events in portions).
I should specify the number of the initial event as the address from under which you want to read, while the number of registers to be read should be the number of events to be read * 8.
The number of registers to be read must be divisible by 8.
The event address must be in the range 0x1000 <= Register <= 0x13FF, where register 0x1000 contains the most recent event
For an Ethernet link, a maximum of 60 events (60*8 registers) can be read in one packet.I would like to retrieve these events and present them in the view and save them in the database.
Please give me a hint on how such functionality can be implemented.
Best regards
July 1, 2025 at 1:26 pm #16550Mikhail
ModeratorHello,
Likely, it’s possible to send the required requests using the existing Modbus Driver. But the driver parses the received packets as current data. Do you think, it can be OK for your task? If so, you could try, and I can help. Otherwise, a custom driver (based on the existing one) may be needed.
-
This reply was modified 1 week, 2 days ago by
Mikhail.
July 1, 2025 at 1:30 pm #16552Mikhail
ModeratorEvents in terms of Rapid SCADA can be generated with Automatic Control Module.
July 1, 2025 at 1:32 pm #16553Mikhail
ModeratorThe event address must be in the range 0x1000 <= Register <= 0x13FF, where register 0x1000 contains the most recent even
Is it possible to read only the most recent event as many times as it exists instead of polling different addresses?
July 1, 2025 at 2:48 pm #16559oley
ParticipantHello,
Thank you for your advice.
I will check if reading from one address is enough.
I will also try the Automatic Control Module and come back with any further questions.July 2, 2025 at 10:46 am #16563Mikhail
ModeratorAutomatic Control Module sends commands to a device. Commands can be for writing a register, and for polling a device.
July 2, 2025 at 1:09 pm #16565oley
ParticipantI’m not sure if I can make it with Automatic Control Module.
This device has a register range for events, which is a circular buffer.One event is written in 8 registers:
0 Event code
1 Value: Lo(Int1), Hi(Int2)
2,3 Value float
4 Lo(month), Hi(end of year)
5 Lo(hour), Hi(day)
6 Lo(second), Hi(minute)
7 millisecondsThe last event is under 0x1000, the pass under 0x1008, and so on.
I would like to save all events in the database and present them in a view already from the database. I think this is the easiest way. The complicated part is reading from the device and storing them in the database.
July 2, 2025 at 1:14 pm #16566manjey73
ParticipantIf the registers go sequentially, you can form the command in binary form, for example, an array of bytes. And send it to the device using multiple recordings. In the template, you can additionally create the necessary commands, separate from reading the registers.
The bigger question here is that reading the main registers is current data, and you may need data from the archive, which is data from the past.July 2, 2025 at 1:29 pm #16567oley
ParticipantDuring SCADA running, I can polling the counter for new events (separate register 0x0500) and read as many as occurred.
After a restart, I would have to read all the events that I did not save in the database to archive the full history.July 2, 2025 at 2:43 pm #16568manjey73
ParticipantThe question is, what is this event, and how many are there?
And I take it they have a past tense? then it’s writing a driver that decomposes these events in the database exactly by time.
Similar to how the driver works with archives. Modbus cannot work with device archives.
You can save them only to the current data.July 2, 2025 at 3:10 pm #16569oley
ParticipantI’m familiar with .NET so driver that decomposes events is a good option.
Should it be a class derived from DevModbusLogic?July 3, 2025 at 5:37 am #16570manjey73
ParticipantYes, Mikhail wrote that you can use the driver as a dependency and write something of your own.
You will have to work with Slice from your part of the new driver. To record data in the channels’ past.
-
This reply was modified 1 week, 1 day ago by
manjey73.
July 3, 2025 at 11:13 am #16575Mikhail
Moderator> The last event is under 0x1000, the pass under 0x1008, and so on.
After the last event is read by the driver, is the previous event moved to the address 0x1000?
If so, it’s possible to use the existing driver.
If not, you need to develop a driver based on the existing. For example, I had to develop a driver (named S2000-PP) in similar situation.July 3, 2025 at 11:39 am #16576oley
ParticipantI am in contact with the manufacturer of the device, because the documentation does not specify this.
Is the code of this S2000-PP driver available for review?July 4, 2025 at 12:23 pm #16580Mikhail
ModeratorIs the code of this S2000-PP driver available for review?
It’s proprietary. If you decide to develop you own driver, I will copy some parts of the source code that can help.
-
This reply was modified 1 week, 2 days ago by
-
AuthorPosts
- You must be logged in to reply to this topic.