Added serial port check before opening

fixed beckhoff print inputs/outputs.