The first brain I've uploaded, it writes decimal 18,34 or 1 to cfg#1 which is wrong #cfg if your serial modbus settings are the same as in screenshot you've posted earlier. "corrupted" brain did the same, and used cfg#3 to write p02.01 (not cfg#2 as I wrote). I've attached the corrected brain.
To perform test, first, manually set p02.01 to RS485, and then, using serial monitor, write decimal values 18, 1, 34, 1 respectively to decimal address 8192 (2000H) to test if those values are correct. If that works as expected (spins forward, stop, spin backwards, stop), manually set p02.01 to 0 (digital keypad), and using serial modbus monitor, write decimal 3 to decimal address 513 (0201H). Manually check if the p02.01 value on VFD is correctly set to 3 (RS485). If that worked, perform first test again. If all good, check serial modbus configuration, disable all #cfg but cfg#0 and cfg#2, make sure that cfg#0 is set as in the screenshot you've attached(port1, address 8192, registers 1, output-holding), and that cfg#2 is set to the same values as cfg#7 in the screenshot I've attached (port1, address 513, registers 1, output-holding). Disable all brains but the one attached, view that brain. Outputs 1 & 2 should be inactive and modbus output for MOD:1-P:0 (address 8192) should be 1 (stop), and for MOD:1-P:2 (address 513) should be 0 (digital keypad). Enter M3 command in MDI. Modbus output MOD:1-P:0 should read 18, and MOD:1-P:2 should read 3, and spindle should run forward. If that works, check M5 and M4 commands. If any of these steps fail, it should point out where the problem is. Brains I'm using will probably not work out-of-the-box for you, since my screen set is totally customized...