Microcontroller › 8051 › Finding out whether a register is present
- This topic has 0 replies, 1 voice, and was last updated 9 years, 2 months ago by Rowan Sylvester-Bradley.
-
AuthorPosts
-
July 15, 2015 at 4:39 pm #3767Rowan Sylvester-BradleyParticipant
My system is based on the 80C320 processor. I need a way to detect which memory mapped input boards are in the system. This is because if I read data from an address that's on a board that is not present, I read random data, which causes all sorts of difficulties within the system. Unfortunately the boards are read only, so I can't write and read back any data.
I notice that the byte I read back from a non-existent location tends to be the least sig byte of the address, presumably because there is enough capacitance on the bus to retain the last level driven if nothing else is driving the bus during the read cycle. I wondered whether I could use this to detect whether a board is present. If I could drive the bus with some data that I have chosen, stop driving, then read from the location I'm trying to test, then if the data read was equal to the data driven, I could assume that nothing was driving the bus at this adress.
I think if I had full control over all the bus lines, I could do it. I.e.:
1. Put the least significant byte of the address I want to test on the bus lines AD0 to AD7.
2. Issue an ALE pulse to latch it.
3. Put the data that I want to use for my test on bus lines AD0 to AD7.
4. Put the most sig byte of the address I'm testing on the bus lines A8 to A15.
5. Tristate bus lines AD0 to AD7.
6. Issue a pluse on RD_.
7. Read the value on the bus lines AD0 to AD7. If they are equal to the test data, then nothing is driving the bus.
But of course I do not have total control of the bus ines (at least, not wiothout a redesign, which I do not want to do just now). And no instruction or combination of instructions that I can find does what I have just described.
The best compromise seems to be to use the lest significamnt byte of the address as the test data, and to test several bytes, but this is not a perfect test, because if the baord is present, but the data happens to be the same as the address, then the test will give the wrong result. Tis may rarely hapen, but it is still not a good design.
Any suggestions for a better solution?
Thanks – Rowan
-
AuthorPosts
- You must be logged in to reply to this topic.