Kazakyborat

I still get the following errors (see below pictures):

 

I am using the newest version of the runtime and the editior, and I updated the editor in the program, so it’s even more updated than what one can dowload.  Firstly, Arduino UNO wifi is not supported at all, so no matter, I’ll use my Arduino Uno without wifi.  I went to slave devices and configured it like so, which was counterintuitive to not just use the settings for Arduino UNO, since that’s what it is, but I configured it as follows (please see the attached photos):configuration.jpgerror messages.jpgMonitor.jpg

I then downloaded and uploaded to my Arduino Uno the blank project, while the runtime was closed, as I get errors if the runtime is open when I upload from the editor.  I made slight edits in terms of normally closed/normally open contacts to get power to the Lamp (or maybe it’s called LED) coil, and this is represented in the monitor screen when the program is running in the runtime. However, I attached an LED to the proper pin (2) and when I run the program and attempt to monitor it, I do not see that LED light up.  Also, when I tried to add a physical button to the program and manipulated it while the program was launched and being monitored in the runtime, I do not get any changes in true false values on the monitor nor does the LED light up.  The switch I used was wired between an ouput pin and ground, and the circuit conencted upon closing the switch.  The TX and RX lights are constantly blinking, so I am not sure what I am doing wrong.  It is too bad, because I am so impressed by the simplicity and user interface of this program and really want to use it to build a prototype that I recently had funded.  I may be new to electronics to some extent, but I believe I have followed the directions to a T.  I know you have already spent some time answering my questions, which I really appreciate, but if there is any way we could either Zoom, or troubleshoot some other way, I would be extreamly appreciaitve.  I also get that you must be very busy, so I am willing to do anything on my end to reduce the time expendature.  Thank you so much.

thiagoralves
Slave devices attach to address 100 onwards (as you can see from the table on your own slave devices tab). Using your variables at %QX0.0 and %IX0.0 is wrong, as it will tell OpenPLC to read local variables.

There is nothing wrong with the Arduino template on the slave devices. You should use that instead of your own crafted Generic Modbus RTU.

As for the Arduino Uno Wifi, it will never work. The Uno board is an 8-bit microcontroller with 2KB of RAM. It does not have the horsepower to run a full IEC 61131-3 program plus manage the WiFi shield. If you need WiFi on your PLC program, use a board that comes with WiFi built-in (like the esp8266, esp32 Arduino Nano 33 IoT, etc).
Reply 1 0
thiagoralves
Update: I grabbed my arduino Uno and tested the setup. It seems that there is some bug with the CRC message calculation on the Uno, which is causing these invalid data messages. I will take a look at this. Meanwhile, you can use the ready-to-use Arduino firmware from here:  https://openplcproject.github.io/runtime/arduino/
You will need the Arduino IDE to upload it to your board. This firmware works perfectly with OpenPLC Runtime
Reply 1 0
Kazakyborat
Thank you very much for your answers.  I guess I am not sure I understand.  I want my Arduino to have inputs and outputs, but when I specify them in the editor as such, it erases the locations and adding them back manually produces an error when I compile it or upload it.  When I try to specify locations for the pins that I connect to buttons or LEDs on the Arduino, and use the documentation provided in 3.2 of your docs, which specify %QX0.0 and %IX0.0 , I have learned from you that is incorrect.  However, when I try to use a local variable (not an output or input as I would like to do but can't seem to manage) I can not put in locations over 100 (to agree with the registers on the runtime slave specifications screen) like %QX100.0 and %IX100.1 and list them as local variables. I want to be able to test an analog sensor I am using after I master digital inputs, which is not going well at this point.  Would it be possible to please tell me what location addresses would be aggregable with the editor and runtime?  Thank you for your time and for answering my questions.  I do not mean to be a burden, but I am so interested in getting this to work that I am more inquisitive than perhaps is appropriate.  Thank you.
Reply 0 0
thiagoralves
%QX0.0 is a local variable
%QX100.0 is a remote variable

If you are working on your Arduino alone - i.e. without a master controlling it - then you should use local variables in the range %QX0.0 as the program will be uploaded directly to the arduino

If you are using the Arduino as a slave, then the program will not be uploaded to the Arduino directly, but will be uploaded to a Master instead. Your Arduino should only have the slave firmware in this case. In this case, since the program will be running on the master, using %QX0.0 means you are handling an output that is local to the master. If you want the master to control the Arduino pin, you must offset that location by 100 => %QX100.0 (this is the Arduino pin on the master perspective)
Reply 1 0
Kazakyborat
That's very helpful.  Thank you for your response.
Reply 0 0
thiagoralves
@Kazakyborat I fixed the issue with the runtime on microcontrollers writing invalid data on Modbus RTU. Since the runtime for microcontrollers is part of the OpenPLC Editor, just update your editor to the latest version (v2.01 release 2022-10-04) and you will be good to go. The recommended approach if you want to have your Arduino as slave is to use the "Blank Project" and upload it through OpenPLC Editor, as stated on the documentation. That way you will be sure you have the latest version of the runtime running on your Arduino board, and that will work as a slave device as well.
Reply 0 0
Kazakyborat
Thank you so much. I really appreciate it!
Reply 0 0
Reply