??? 12/17/04 07:28 Read: times |
#83294 - two DPTRs Responding to: ???'s previous message |
hi,
AT89S52 has two DPTR registers, AT89C52 only one. If you use DPTR register with AT89S52 you must define actual DPTR register in AUXR1 register first.
Not necessary. I agree that setting of SFRs at start-up is the "good programming" style. Nevertheless, AUXR1 has defined reset value where its DPS bit is zero after reset. It means that after reset, AT89S52 uses DPTR0 which address is the same as one of DPTR in AT89C52. And this everytime you address the DPTR, equally whether you switch between both DPTRs or not.
Could you explain, please? So, a code which works for AT89C52 will very probably not work with AT89S52, if you use DPTR register!!
No, if you do not change DPS bit of AUXR1 register anyhow accidentally, then it is not a reason of the incompatibility. As AT89C52 has not defined SFRs address 0xA2 (where AUXR1 is placed at for AT89S52) so it is very unlikely that original poster accesses this address and does un-controlled switching of DPTRs. The actual reason I see is hardware problems. For example, if Kuldeep Singh uses RC reset net then it may be a real problem: AT89C52 has reset pull-down resistor 50-300k, while AT89S52 does 10-30k only. So it may happen then reset time is not enough with low value of capacitor. Regards, Oleg |