tonymonty
Hi, Could you tell me how I would send an INT variable to a ESP8266 slave from raspi Openplc runtime program? Should I use %MW? How would I do that? Create an INT variable on both sides with address %MW0?
Thank You
Reply 0 0
thiagoralves
Once you add the esp8266 as slave, all the %QX, %IX, %QW and %IW of the slave will be mapped to the master. If you’re running a program on the slave and don’t want to map all of them then you need to create a custom profile on the master (instead of picking the esp8266 one) and just map the addresses you want. If you map for example just one holding register as write, that register will show up on the master as %QW100 and whatever you write to QW100 will show on the slave
Reply 0 0
tonymonty
Thanks for the help. I guess I'm having trouble wrapping my brain around this. When I use a contact, I assign it to a Modbus bit and when the contact closes, I see it. I'm not visualizing how you would sort of pack say the number 10 in a variable and then send it and on the other side know it's there and unpack it. I'm sure I'm overthinking.
Reply 0 0
thiagoralves
You don’t have to pack or unpack things. Bits are sent as bits (%QX, %IX). Numbers are sent as Numbers (%QW, %IW). Perhaps if you explain better what you’re trying to accomplish we will be able to help you more
Reply 0 0
tonymonty
So if I want to change the preset count for a CTU in the slave(ESP8266), do I have an INT variable in the raspi PLC at say %MW0 and an INT variable on the slave also at %MW0? How would i write to the CTU preset input from the raspi ladder program?
Reply 0 0
tonymonty
Ok, quick update, I tried just getting familiar with writing to the holding register on the slave with Radzio. It is working and helping to teach me Modbus. Thank you for taking the time to help me and also create this sweet system. I've been working with it for about a week and have a nice little setup with a Raspi Zero W, touchscreen, Python and Tkinter GUI, and the distributed IO on the ESP8266s. This is all very powerful. Thanks!!
Reply 0 0
thiagoralves
Radzio is a good tool to get familiar with Modbus. What you see Radzio doing is exactly what the OpenPLC Runtime will do on your Raspberry Pi automatically. It will constantly read registers and write to registers. You don't have to do anything for a write request to be sent. In essence, after mapping your slave device to your Raspberry Pi, the variables mapped to %QW100, %IX100, %QX100.0, %IX100.0, etc on your Raspberry Pi program will be a mirror of your slave device. If you write anything to %QW100 from the Pi, it will automatically be written to holding register 0 (%QW0) on your slave device.
Reply 0 0
tonymonty
Yep, everything is coming into focus now. Again, thank you for your help and providing such a powerful tool. My first focus for this setup is to provide a motion test center at work. That will quickly and easily be expanded to cover testing for most of our electronic systems.
Reply 0 0
Reply