I'm glad you have found a way to make it work.
What settings did you set in MAX?
Above you attached 3 files.
Which of these serial port settings are the correct ones your device is expecting.
So if you fixing the parameters in MAX makes it work, then must not be setting those parameters in your LabVIEW code.
The problem seems to be what Bill pointed out in his 2nd paragraph back in message 12.
RS 485 checking 2 default values wont be used. When I run the program it will com port 8, 38400 baud rate and parity even and so on. Check the screenshot of the front panel above. It is same as the configure RS 485 vi. Second point you have mentioned is I didnt use this VI. Which was a mistake. I did use it right after the 24DIO vi. In the block diagram it comes right after 24 DIO to configure this to the above mentioned values and then give it to the next set which is the modbus. I did it like that and it didnt work. The one I uploaded was a mistake. That was me try something different. Instead of uploading the original version, I uploaded the changed one. I have uploaded the original one again. But I didnt understand what is the error.
Put indicators or probes on your error wires. Just in case something is causing an error and preventing later code from executing.
If you can get your code to work in once situation, but can't in another, then obviously something is different. I can't execute your code since I don't have your equipment. You'll have to apply the troubleshooting techniques to sort it out.
So what you are saying is it should work. Can you just check the flow of the program and see if anything is wrong, that is had I put everything in the right place? I am not talking about the values. Just the connections. Are all the connections right. That is what I want to know. You don't have to execute the code. Anyway thanks a lot for your help so far.