elllo
Hi,
 
I am working with the OpenPLC runtime on a RPI 4. I am trying to run a simple SFC program (see below) but I am getting a compilation error which I do not understand at all (see below screenshot). Even when I create a more basic SFC program (2 steps and 2 transitions), it yields compilation error. I have already maned to get a ladder program working tho. Some help would be appreciated 🙂
openplc_error.jpg
 
Error generated :
 
In file included from C:\Users\Elouan THEOT\OpenPLC_Editor\matiec\lib\C/iec_std_FB.h:35,
from C:\Users\Elouan THEOT\OpenPLC_Editor\matiec\lib\C/iec_std_lib.h:757,
from C:\Users\Elouan THEOT\Documents\Ingé\S9\PER\OpenPLC Grafcet\build\Res0.c:6:
C:\Users\Elouan THEOT\Documents\Ingé\S9\PER\OpenPLC Grafcet\build\POUS.c: In function 'GRAFCET_body__':
C:\Users\Elouan THEOT\OpenPLC_Editor\matiec\lib\C/accessor.h:88:13: error: 'STEP' has no member named 'value'
88 | name.value __VA_ARGS__
| ^
C:\Users\Elouan THEOT\OpenPLC_Editor\matiec\lib\C/accessor.h:126:81: note: in definition of macro '__SET_VAR'
126 | if (!(prefix name.flags & __IEC_FORCE_FLAG)) prefix name.value suffix = new_value
| ^~~~~~~~~
C:\Users\Elouan THEOT\Documents\Ingé\S9\PER\OpenPLC Grafcet\build\POUS.c:164:46: note: in expansion of macro '__GET_VAR'
164 | __SET_VAR(data__->,__transition_list[3],,__GET_VAR(data__->PAUSE,));
| ^~~~~~~~~
C:\Users\Elouan THEOT\OpenPLC_Editor\matiec\lib\C/accessor.h:88:13: error: 'STEP' has no member named 'value'
88 | name.value __VA_ARGS__
| ^
C:\Users\Elouan THEOT\OpenPLC_Editor\matiec\lib\C/accessor.h:126:81: note: in definition of macro '__SET_VAR'
126 | if (!(prefix name.flags & __IEC_FORCE_FLAG)) prefix name.value suffix = new_value
| ^~~~~~~~~
C:\Users\Elouan THEOT\Documents\Ingé\S9\PER\OpenPLC Grafcet\build\POUS.c:171:54: note: in expansion of macro '__GET_VAR'
171 | __SET_VAR(data__->,__debug_transition_list[3],,__GET_VAR(data__->PAUSE,));
| ^~~~~~~~~
C:\Users\Elouan THEOT\OpenPLC_Editor\matiec\lib\C/accessor.h:88:13: error: 'STEP' has no member named 'value'
88 | name.value __VA_ARGS__
| ^
C:\Users\Elouan THEOT\OpenPLC_Editor\matiec\lib\C/accessor.h:126:81: note: in definition of macro '__SET_VAR'
126 | if (!(prefix name.flags & __IEC_FORCE_FLAG)) prefix name.value suffix = new_value
| ^~~~~~~~~
C:\Users\Elouan THEOT\Documents\Ingé\S9\PER\OpenPLC Grafcet\build\POUS.c:176:46: note: in expansion of macro '__GET_VAR'
176 | __SET_VAR(data__->,__transition_list[4],,__GET_VAR(data__->PAUSE,));
| ^~~~~~~~~
C:\Users\Elouan THEOT\OpenPLC_Editor\matiec\lib\C/accessor.h:88:13: error: 'STEP' has no member named 'value'
88 | name.value __VA_ARGS__
| ^
C:\Users\Elouan THEOT\OpenPLC_Editor\matiec\lib\C/accessor.h:126:81: note: in definition of macro '__SET_VAR'
126 | if (!(prefix name.flags & __IEC_FORCE_FLAG)) prefix name.value suffix = new_value
| ^~~~~~~~~
C:\Users\Elouan THEOT\Documents\Ingé\S9\PER\OpenPLC Grafcet\build\POUS.c:183:54: note: in expansion of macro '__GET_VAR'
183 | __SET_VAR(data__->,__debug_transition_list[4],,__GET_VAR(data__->PAUSE,));
| ^~~~~~~~~
Reply 0 0
thiagoralves
Your SFC diagram seems to be wired incorrectly from the picture. You must always have a step after a transition, something like the picture below:
Screenshot 2024-10-16 at 10.36.57 AM.png
Reply 0 0
elllo
Hi Thiago !
 
Thx for the quick response, though I don't see where I badly wired my diagram ? Because now (without having changed anything) it compiles properly but when I upload it to the runtime it can't compile ...
[203128%2F9027025%2Fmceclip0]
Reply 0 0
elllo
I tried to change my diagram :
[203128%2F9027031%2Fmceclip0]
 
But the same error occurs on the runtime app ...
Reply 0 0
thiagoralves
Your error could be elsewhere, which is hard to know without seeing your project.
Reply 0 0
thiagoralves
Just took a look at the first picture you posted, there are some more errors in there:
Screenshot 2024-10-16 at 5.13.25 PM.png
 
You cannot have three variables located at the same address (%QW100). Also, %QW100 cannot hold a DINT, as a DINT is 32-bits and a %QW location is 16-bits. You must change it to INT, UINT or WORD.
Reply 0 0
streatstyle
I read in the documentation you can use
  • X for bit (1 bit)
  • B for byte (8 bits)
  • W for word (16 bits)
  • D for double word (32 bits)
  • L for long word (64 bits)
How do you implement them? I tried to set one up just as a trial, but it wouldn't load up caused an error maybe I don't quite understand how it works would you just use %QD0? or is that not how it's used.
Just took a look at the first picture you posted, there are some more errors in there:
Screenshot 2024-10-16 at 5.13.25 PM.png
 
You cannot have three variables located at the same address (%QW100). Also, %QW100 cannot hold a DINT, as a DINT is 32-bits and a %QW location is 16-bits. You must change it to INT, UINT or WORD.
Reply 0 0
thiagoralves
You can use %MD0. %Q and %I can be combined only with X (bit) and W (word)
Reply 1 0
elllo
Thx Thiago, indeed my errors were loacted in the variable definitions !
Reply 1 0
Reply