Here is a description of the -10613 error code -10613 is "the specified channel does not support the specified transfer direction."
If the port is configured for output and you read from the port (you should receive a warning and error code should be 10613 not -10613). Or you are trying to write to a digital port that is configure for read (error should be -10613 because this is not a supported function).
If you are using a 6503 or 6508 in MAX there may be a button that says configure port after you select the port number.