Orphennn
Hello,

I am learning to use OpenPLC so I am starting to do the blinking LED on my Arduino Mega with built-in LED (pin 13 so %QW11 adress)

OpenPLC cannot compile the program and show the following error:

Compiling .st file...
plc_prog.st:3-5..3-29: error: Bit size of data type is incompatible with bit size of location.
1 error(s) found. Bailing out!
Error: Couldn't find LOCATED_VARIABLES.h. Check iec2c compiler output for more information

I feel something went wrong while installing the runtime on my Arduino Mega. How can I reinstall the runtime ? I have no other idea why this basic example do not work.

Thank you for your help.
Yannick
Reply 0 0
thiagoralves
%QW is an analog output. You cannot assign a BOOL variable to it. You must pick a pin on the %QX range
Reply 0 0
Orphennn
Dear Thiago,

Thank you for your reply. The build-in LED on the Arduino Mega is connected to digital output pin 13. Following the documentation on the OpenPLC website, physical adress for pin 13 is %QW11 and this is an analog output.

Do I missunderstand something with the physical adress table for Arduino Mega ?
Reply 0 0
thiagoralves
No, you did not misunderstand anything. That pin is indeed an analog output because on the Mega that pin is PWM capable. You will have to choose another pin that is purely digital, or modify the blink program slightly to, instead of just setting the pin true or false, move 65535 or zero to the pin to make it blink. The nice part of it is that instead of blinking, you can make it glow. For example, 32768 will make it lit with half intensity. You can get creative…
Reply 1 0
Orphennn
Thank you for your work and your help. I will read some basic tutorial about ladder programmation.

One last question. Do you think it is possible to generate a sinus wave at a given frequency on an analog pin with OpenPLC and arduino ?
Reply 0 0
Reply