Use a pronoun instead of a noun only if the connection to the intended antecedent of the pronoun is quite strong. Make sure no other nouns with the same gender and number appear between your pronoun and its intended antecedent. Otherwise, your pronoun reference may be unclear.
When a second character arrives at the port before the first character has
been unloaded, the port stores the second character in the same register,
overwriting it.
When a second character arrives at the port before the first character has
been unloaded, the port stores the second character in the same register as the
first one, overwriting the first character.
--Computer Telephony (modified)