-
Path: news-archive.icm.edu.pl!news.icm.edu.pl!news.chmurka.net!.POSTED.h82-143-187-50
-static.e-wro.net.pl!not-for-mail
From: "J.F" <j...@p...onet.pl>
Newsgroups: pl.misc.elektronika
Subject: Re: Multiplekser/sniffer/arbiter modbus
Date: Sat, 8 Apr 2023 09:40:29 +0200
Organization: news.chmurka.net
Message-ID: <1tu1myj3d8q10$.19bnqf7467l4n.dlg@40tude.net>
References: <u0jesg$3rbf4$1@dont-email.me>
<4...@g...com>
<u0kfa6$513$1@dont-email.me>
<642dcc7b$0$19610$65785112@news.neostrada.pl>
<u0kjt4$nps$1@dont-email.me>
<642dd9da$0$19615$65785112@news.neostrada.pl>
NNTP-Posting-Host: h82-143-187-50-static.e-wro.net.pl
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: news.chmurka.net; posting-account="jfoxwr";
posting-host="h82-143-187-50-static.e-wro.net.pl:82.143.187.50";
logging-data="25933";
mail-complaints-to="abuse-news.(at).chmurka.net"
User-Agent: 40tude_Dialog/2.0.15.1
Xref: news-archive.icm.edu.pl pl.misc.elektronika:779611
[ ukryj nagłówki ]On Wed, 5 Apr 2023 22:28:10 +0200, Piotrek wrote:
> On 05.04.2023 21:58, heby wrote:
>> Liczyłem na jakiś ... powiedzmy ... gotowiec z 3 dziurkami RS485,
>> obsługujący 2 masterów i 1 slave. Chyba nie jestem jedyny na świecie z
>> takim pomysłem ;)
>
> GPT twierdzi, że nie ma ;-)
>
> "[...]
>
> Unfortunately, there are no known open-source projects that implement a
> two-master, one-slave Modbus architecture. However, you can start with
> existing Modbus libraries (e.g., libmodbus, FreeModbus) and modify them
> according to the outlined approach to develop your custom solution."
>
> ale przyciśnięty do muru
>
> Are you sure there is no such open source project?
>
> zaczął programować w Python. LOL
Moze od razu poprosic o kod na wybrany uC ? :-)
> "I apologize if my previous response may have been unclear. While it is
> challenging to be aware of every single open-source project available,
> to the best of my knowledge (as of the knowledge cutoff in September
> 2021), there was no specific open-source project that implements a
> two-master, one-slave Modbus architecture.
>
> However, you may find open-source projects that implement Modbus
> gateways or proxies, which you could adapt to achieve the desired
> two-master, one-slave communication. One such project is modbus-tk, a
> Python library that allows you to create Modbus masters and slaves, and
> it includes a TCP to Serial gateway implementation.
>
> Project Repository: https://github.com/ljean/modbus-tk
>
> Here's a basic example of how you can use modbus-tk to create a Modbus
> TCP to Serial gateway:
>
> python
>
> import modbus_tk
> import modbus_tk.defines as cst
> from modbus_tk import modbus_tcp
> from modbus_tk import modbus_rtu
>
> def main():
> # Configure Modbus RTU master
> master_rtu = modbus_rtu.RtuMaster(
> modbus_tk.utils.create_serial_handler(port="/dev/tty
S0")
> )
> master_rtu.set_timeout(5.0)
> master_rtu.set_verbose(True)
>
> # Configure Modbus TCP server
> server_tcp = modbus_tcp.TcpServer(address="0.0.0.0", port=502)
> server_tcp.start()
>
> # Main loop to process Modbus TCP requests and forward them to
> Modbus RTU
> while True:
> try:
> request = server_tcp.get_request(blocking=True)
> if request is not None:
> response = master_rtu.execute(
> request.slave_id,
> request.function_code,
> request.starting_address,
> request.quantity_of_x,
> request.output_value,
> )
> request.set_response(response)
>
> except modbus_tk.modbus.ModbusError as exc:
> print("Error processing request:", str(exc))
>
> if __name__ == "__main__":
> main()
>
> This example creates a Modbus TCP server that forwards incoming requests
> to a Modbus RTU master. You could extend this example to support two
> Modbus TCP masters and manage the communication with the single Modbus
> RTU slave.
I to jest przykład z powyzszego archiwum, czy GPT napisal sam ?
> Please note that this example uses Python, and you would need to adapt
> the code to your specific requirements, such as handling communication
> conflicts between the two masters."
>
> P.
J.
Następne wpisy z tego wątku
- 08.04.23 16:07 Dawid Rutkowski
- 08.04.23 16:39 heby
- 08.04.23 16:40 heby
- 14.04.23 22:53 M M
Najnowsze wątki z tej grupy
- Thunderbird i dysk...
- opornosc falowa
- Bateria 9V 6F22, alkaliczna v cynkowa, samorozładowanie, bateria wysokiej trwałości do miernika
- Tani zakup z ali?
- w czasach LED komary mają ciężko
- walizka z kodami
- Rejestrator temperatur - termopara, siec
- Router LTE z możliwością zmian MTU
- Fajny film widziałem...
- Jaka ładowarka sieciowa do Iphona?
- Taśma izolacyjna do prac elektrycznych
- Recenzja 3.1A ;) w 6 gniazdach...
- Re: Recenzja 3.1A ;) w 6 gniazdach...
- Re: Recenzja 3.1A ;) w 6 gniazdach...
- Re: Recenzja 3.1A ;) w 6 gniazdach...
Najnowsze wątki
- 2025-07-23 Gdańsk => Programista Delphi <=
- 2025-07-23 Gdańsk => Programista Mainframe (z/OS, Assembler) <=
- 2025-07-23 Warszawa => Starszy inżynier DevOps (AWS) <=
- 2025-07-23 Gdańsk => Mainframe (z/OS, Assembler) Developer <=
- 2025-07-23 Kraków => Senior Fullstack Engineer (Low-Code Platform) <=
- 2025-07-23 Wrocław => Senior Key Account Manager IT <=
- 2025-07-23 Trójmiasto => Head of Social Media <=
- 2025-07-23 Rzeszów => Spedytor Międzynarodowy <=
- 2025-07-23 Lublin => ERP Implementation Consultant (AP Module) <=
- 2025-07-23 Środa Wielkopolska => SAP FI/CO Internal Consultant <=
- 2025-07-23 Warszawa => Inżynier oprogramowania .Net <=
- 2025-07-23 Kraków => Kotlin Developer <=
- 2025-07-23 Żerniki => Dyspozytor Międzynarodowy <=
- 2025-07-23 Warszawa => Java Developer <=
- 2025-07-23 Wrocław => Konsultant wdrożeniowy (systemy controlingowe) <=