Re: difference between I/O ports and memory

Ed Casas (edc@ece.ubc.ca) Tue, 5 Dec 2000 22:21:34 -0800


Date: Tue, 5 Dec 2000 22:21:34 -0800
From: Ed Casas <edc@ece.ubc.ca>
Subject: Re: difference between I/O ports and memory

Hi, > The question involves a memory location at 200 (hex). I assume that you put > hex in brackets to mean that the address is 0x200? Yes. > But in the question we read from seven of the 8 bits. The last > one you stated as undefined. The first bit states if the alarm > is on or off. You asked to check if the alarm was on as well > as any of the sensors. So I guess you'd have to "or" it with a > mask to make sure alarm was on and then again to see if any > sensors are on. In that case it states that we should write > 0x01 to the 0x200 address. And if the alarm is off or if it is > on with all the sensors off then we are to write 0x00 to the > 0x200 address. I don't see the purpose of this though. When > we check the address if the alarm is on then that first bit is > already set on anyways. What is the point of us writing 0x01 > to it? And same with the 0x00. What is the purpose of writing > that to the same address that we read the data from in the > first place? I/O ports are not the same as memory. When you write to memory that is implemented as RAM the value gets stored in the RAM and you can read the value back. However, when you write to an output port the values get loaded into flip-flops (one per bit). The flip-flop outputs are the port outputs. However, there is no good reason to connect an input port to read the values on those outputs -- in fact, it would be a waste of input pins because you already know what was written there. -- Ed Casas edc@ece.ubc.ca http://casas.ece.ubc.ca +1 604 822-2592