That is a bit tricky. I would recommend that you test one part of the software separately at a time. ie. Use RS485 for monitoring/programming while testing the serial comm routine for RS232 port, and vice versa.
You should build into your software a way for you to start/stop the serial communication routine (say, by using an input to enable/disable) so that at anytime you can stop the PLC from using the serial port and you can connect the PC to perform monitoring/program changes.