Hello,
here I can show example of saving INT values int txt file on Raspberry Pi SD
I have used pymodbus TCP to create modbusMaster(client) on port 503, with 10 holdt_register and 10 input_registers
in Cosesys v3 create ModBusSlave TCP also with 10 holdt_register and 10 input_registers,
if raspberry pi shut down , at start you can get 10 int values from file vars.txt on SD
Hello,
here I can show example of saving INT values int txt file on Raspberry Pi SD
I have used pymodbus TCP to create modbusMaster(client) on port 503, with 10 holdt_register and 10 input_registers
in Cosesys v3 create ModBusSlave TCP also with 10 holdt_register and 10 input_registers,
if raspberry pi shut down , at start you can get 10 int values from file vars.txt on SD
steps DB master.txt [4.24 KiB]
WebvisuMBtcpSlave.project [478.19 KiB]
How to make start at boot pymodbus master(client)
using PuTTY:
#sudo nano /etc/init.d/autorun
and paste text from autorun.txt
Ctrl + x
y
Enter
#sudo chmod 777 /etc/init.d/autorun
#sudo update-rc.d /etc/init.d/autorun defaults
#cd /home/pi/Documents/pymodbus/examples/common
root@raspberrypi:/home/pi/Documents/pymodbus/examples/common# sudo nano test.py
and paste text from test.py.txt
Ctrl + x
y
Enter
before ShutDown RaspberryPi Download CodesysProject and try:
#sudo /etc/init.d/autorun start
output:
Starting autorun
done
wait to start ethernet , wait for Codesys Slave to start 20sec
cycle: 1
Input0: 57648
Input1: 57649
Input2: 57650
Input3: 57651
Input4: 57652
Input5: 57653
Input6: 57654
Input7: 57655
Input8: 57656
Input9: 57657
line0: 57648
line1: 57649
line2: 57650
line3: 57651
line4: 57652
line5: 57653
line6: 57654
line7: 57655
line8: 57656
line9: 57657
cycle: 2
test.py.txt [3.47 KiB]
autorun.txt [910 Bytes]
thanks for sharing the application!
It is now available here:
l viewtopic.php?f=23&t=6247&p=13503#p13719 l