So far I have made software for the same hardware that can detect whether an AT89S52 or an AT89LP52 is inserted into it because the introductory bytes required to enable their programming and receive chip signature is similar (except the address of the signature values are different).
Now I want to use the same software to automatically detect that an AT89LP4052 is inserted in. I don't want to make the end user specify the chip he is using. I want the software to discover it automatically.
When I look at the datasheets for the AT89S52 and AT89LP4052, I notice that the AT89LP4052 expects each command to start with AAh before the actual command. The other chips don't require this.
I want to somehow be able to read signatures of every chip without making another chip think that some awkward command designed for another chip makes the current chip not work correctly.
In the end, I want to insert an AT89S52 or an AT89LP4052, or an AT89LP52 into my hardware programmer, plug it into the computer and run the software (just by typing in the one command with zero parameters) and then when I press enter, I expect the software to tell me whether the chip is an AT89S52 or an AT89LP4052, or an AT89LP52.
What kinds of codes and what order should I send them to the (not-yet-known) chip to figure out what it is? (Like what digits)?
Can you add a command to the chip can respond with a majic number? Pretty standard to have a command that returns capabilities (eg a rev number).