Homework 3. Due October 10, 2001

Show the contents of A as requested below, given the circuit shown in the figure. 
Refer to AT89 series hardware description section on Port Structure and Operations.

MOV    A,  #FFh         ;  A =  FF (immediate addressing mode)
MOV    P1, A;           ;
this basically puts P1 into "input" mode  
MOV    A,  P1           ; A =  AA (10101010) The voltage across the resistors is 0 because the pull-down transistors are not enabled
XRL    P1, A;           ; this is a read-modify-write instruction that that updates the P1 latch based on the current value in the latch, not on the pins. P1 = FF xor AA = 55
this makes all of the odd pins into outputs, and even ones into inputs.

MOV    A,  P1           ; A = x0x0x0x0. The 1K pull-up resistors are tool small* (source too much current) for the voltage on the input pins to be reliably read as a zero or a one. The results are undefined (could be 1 or 0).

Is this circuit safe for the 8051? Explain your answers.

In the worst case, the effective pull-down resistance = 0. Therefore, the maximum possible current sunk by each pin is 5/1K = 5mA, or 20mA for the port, which is out of spec. Therefore unsafe.

*At 1.6mA, the voltage at the pin is guaranteed to be less than .45V, which will be read as a zero. However, 1.6mA*1K = 1.6V. So there are still 3 volts un accounted for. This means increased current (more than 1.6mA) and probably more than .45volts at the pin. We don't have enough info to know whether or not the voltage at the pin will be low enough to be reliably read as a 0, so the results are undefiined. The smallest signal-safe pull-up resistance is 4.55/1.6mA =  ~2.8K.

 

Max Vlow = .9V

Min Vhi = 1.9V