I am encountering issues establishing a Modbus connection between my PLC and Drive. Initially, I successfully open the port, but when setting up the Modbusmaster, I encounter two errors. The first error occurs when trying to assign a boolean to the trigger, and the second error arises when filling the communication fields with an array in int format. During compilation, an error message stating "Modbusmaster: argument expected" is displayed. Are you familiar with these issues and have any solutions in mind?
To open the instruction editor, simply double click on the instruction text. Make sure to enter all necessary information in the provided pop-up window. It is important to specify the version you are using for troubleshooting purposes. Port 1 is typically designated as "MJ1" for easy reference. The trigger function activates the request when there is a transition from OFF to ON. Instead of manually entering the contact, you can input something like "%I02" for efficiency. Pro-tip: Press F1 after highlighting the instruction for quick access to the help file, which provides valuable information on what is required.
When you double click on the instruction, a pop-up window will appear for you to enter the necessary information. What version of Cscape are you currently using? Typically, port 1 is referred to as "MJ1". The "Trigger" is a single-bit function, where transitioning from OFF to ON will activate the request. Instead of using a contact, try inputting something like "%I02". Moreover, if you highlight the instruction and press F1, the help window will display relevant information. Make sure to review the help file for any additional requirements. I am currently working on Cscape version 9.90, but the pop-up window doesn't seem to be working, potentially due to using the IEC 61131 version. If you are utilizing the MJ1 port, you shouldn't have encountered any communication issues. I am currently attempting my first connection test and encountered an error requesting a variable. After trying %M1, I consulted the block documentation, but couldn't find any information regarding acceptable variable types. This is where I believe I may be missing something Siemens-related.
Upon closer inspection, you will notice that it actually sets a BOOL value. This BOOL can be part of a register, I/O, or any other component. I do not utilize the tag-based or IEC versions. The pop-up should appear as part of the cScape functionality, so it is unclear why you are not seeing it. Have you checked the port/network configuration in the hardware section on the left pane? Setting up your communication and variables for Modbus data may be more streamlined there. Regardless, you will need to configure your communications, ports, and protocols.
Utilizing Port MJ2 for Modbus communication, some historical screen captures could provide valuable assistance.
By following the setup depicted above, you can avoid the hassle of opening ports and triggers on your ladder system. This eliminates the need for extra configuration steps, making the process more streamlined and secure.
From your description, it looks like you're having trouble assigning the right data types to your Modbusmaster functions. For the boolean trigger error, make sure that the PLC and Drive both understand and accept the boolean data type; in some cases using integer representation (0 and 1) can be more effective. As for the second issue, when populating the communication fields with an integer array, each array index should correspond to a specific Modbus register. If you've ensured these steps and the errors still persist, you might want to revise your Modbus library or consider using a different Modbus library to avoid any compatibility issues. Hope this helps, and I'm here if you have more questions.
It's a common issue and usually relates to some details being missed during the setup process. For the first issue, ensure that the trigger variable assigned in PLC is of the same boolean type as expected by the Modbusmaster. For the second problem, it sounds like the Modbusmaster expects an array of bytes, not ints. Try converting the int array to a byte array before filling the communication fields. For a more accurate solution, it would be useful to know which PLC and Drive models you're using because setup details could be different for various models. It's also worth checking the documentation for your specific hardware, they often contain troubleshooting tips for such issues.
It seems like your Modbusmaster may not be properly initializing or not receiving the expected data type. Double-check your program logic and the format of the array you're using. Make sure your boolean variable and the array are defined properly according to the Modbusmaster requirements before being initialized. Your error message suggests that the Modbusmaster is expecting a particular argument format. Refer to Modbus documentation; remember that Modbus protocol uses 16-bit register values in 'decimal format'. A common mistake is using an 'int' format when 'binary' or 'hex' is needed. If that doesn't help, could you provide more details about your setup and the exact code you're using? That way, we might be able to pinpoint the issue with greater accuracy.
It sounds like you're running into a couple of common issues with Modbus implementation. For the boolean trigger, you might want to double-check the data type expectations in your Modbus library; sometimes these can be quite specific about what they accept. As for the array being used in the communication fields, ensure that you are passing the correct size and type, as some libraries require a specific format (like a pointer or structure) rather than a plain array. It might also help to review any documentation or examples provided with your specific Modbus library to see if there are any nuances you might have missed. If possible, sharing the relevant code snippets could also help us pinpoint the issue further!
✅ Work Order Management
✅ Asset Tracking
✅ Preventive Maintenance
✅ Inspection Report
We have received your information. We will share Schedule Demo details on your Mail Id.
Answer: 1. What could be causing the error when trying to assign a boolean to the trigger in the Modbus setup process? - The error when trying to assign a boolean to the trigger in the Modbus setup process could be due to incorrect data type compatibility or syntax errors in the code.
Answer: - The error related to filling the communication fields with an array in int format could be resolved by ensuring that the correct data type is used for the array elements and verifying the syntax of the code.
Answer: - To troubleshoot the "Modbusmaster: argument expected" error message during compilation, double-check the arguments being passed to the Modbusmaster function calls, ensuring they match the expected data types and format.
Join hundreds of satisfied customers who have transformed their maintenance processes.
Sign up today and start optimizing your workflow.