Machine Automation Forum
A forum addressing machine automation solutions for the complete machine lifecycle. Including offers like Machine Advisor, Modicon PLC/PacDrive, Lexium or Preventa. Discuss and share knowledge on offers relating to cloud-based service platforms, machine localization and monitoring, industrial operations control, motion products as well as safety function!
Link copied. Please paste this link to share this article on your social media post.
Posted: 2024-07-15 08:01 PM
Hello, I am using Machine Expert 1.2.7 to program a TM241 PLC.
I am having trouble assigning an address (Modbus register) to a variable of type BOOL because at certain times, using the address %MX causes the variable to become a BIT type.
I need to keep using BOOL because I need to use the variable as an IN_OUT variable for a function block.
If I use MB or MW for the address in the declaration, during compilation, I get a "Bad Declaration, use %MX for 'BOOL' variable" error. Is there another way to assign the address and maintain the type as BOOL and not BIT?
Thank you.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2024-07-16 11:21 PM
Did you try to use %MWx.y instead of %MXx ?
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2024-07-17 09:47 PM
I am also using ESME V1.2.
I declare the variable like below.
--------------------------------------------
{attribute 'qualified_only'}
VAR_GLOBAL
xG_mccbAl AT %MX2000.0: BOOL;
xG_elbAl1 AT %MX2002.0: BOOL;
xG_elbAl2 AT %MX2002.1: BOOL;
xG_elbAl3 AT %MX2002.2: BOOL;
xG_elbAl4 AT %MX2002.3: BOOL;
xG_elbAl5 AT %MX2002.4: BOOL;
xG_elbAl6 AT %MX2002.5: BOOL;
END_VAR
--------------------------------------------
Link copied. Please paste this link to share this article on your social media post.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.