I have been using a PCF8583 on my old HC705B controller for years, with a synthetic IIC from 2 I/O lines, and one of the 2 was multiplexed with another peripheral.
Perhaps today I would use the DS1337 which seems to be newer and cheaper. It too uses IIC.
Encoder