I Need help for AT89c2051 programming.

Discussion in 'Embedded Systems and Microcontrollers' started by Parv Bhavsar, Apr 12, 2016.

  1. Parv Bhavsar

    Thread Starter New Member

    Apr 12, 2016
    15
    0
    I am doing project in which i will be having two dc sources.
    One is Consistent 12v and onther one is fluctuating...
    I will be using analoge comparator of AT89C2051,
    I am having two problems
    1)during using keil 5.0 i use <reg89x51.h> and <at89c2051.h> but after debugging and run messege appears "cant open the file"
    2)I want to turn on severel optocouplers PC817 using PORT 1 pins....
    Can port 1 pins provide enough voltage and current to drive pc817?
     
  2. Papabravo

    Expert

    Feb 24, 2006
    10,148
    1,791
    I don't think the 8051 Port 1 pins can do an adequate job of driving a garden variety optocoupler. The output drivers are not symmetrical; they can source about 400 μA, and sink about 3.2 mA. Depending on the CTR of the optocoupler you might be able to use a low going output to put 3.2 mA through the diode side, but if the CTR is low, 20% for example, the Ic of the output transistor would only be 640 μA. It will also get worse with age, that is why you might want some margin.

    You might also want high efficiency LEDs which have acceptable brightness at much lower current levels than standard LEDs. One question -- why can't you read the datasheet for yourself and discover this information on your own?
     
  3. Brevor

    Active Member

    Apr 9, 2011
    279
    54
    AT89C2051 port pins can source or sink 20 ma.
     
  4. Papabravo

    Expert

    Feb 24, 2006
    10,148
    1,791
    Had to check the datasheet on this one cuz I assumed it was an MCS 8051 compatible part.
    Your claim of a symmetrical output stage is demonstrably false. I agree that the Port 1 outputs can sink 20 mA, which is an upgrade from previous 8051 compatible parts, but they cannot source 20 mA by a long shot. 80 μA @ Voh of 2.4 V minimum. Learn to read a datasheet.

    So 20 mA is more than enough to drive an opto, even with a poor CTR. Just connect the port pin to the cathode of the diode and pull it low to turn it on. Don't forget the current limiting resistor from the anode to Vcc.
     
    Last edited: Apr 12, 2016
  5. Parv Bhavsar

    Thread Starter New Member

    Apr 12, 2016
    15
    0
    so as you
    so as you said i willconnect port 1 pin to cathode of pc817 and pull the pin low to turn on optocoupler.
    And
    Please tell tell me all registries that will be needed for at89c2051
     
  6. Papabravo

    Expert

    Feb 24, 2006
    10,148
    1,791
    I'm not sure what you are asking with "tell me all registries that will be needed for AT89C2051"
     
  7. Brevor

    Active Member

    Apr 9, 2011
    279
    54
    Thanks, Papabravo for having the diligence to check the datasheet. I was answering from old memories.
     
  8. Papabravo

    Expert

    Feb 24, 2006
    10,148
    1,791
    No need to apologize, I too was remembering the original 8051 architecture which was "innovative" in 1978, but now not so much.
     
  9. Parv Bhavsar

    Thread Starter New Member

    Apr 12, 2016
    15
    0
    hello
    i got my controller working with acs712
    by which i will be switching a secondary 12v dc source if primary gives supply to any load...
    when i connect load to primary source pin 1.4 and pin 1.3 gives +5V and almost 0mA,
    cant figure out how to drive 2N2222 with that voltage..
     
  10. absf

    Senior Member

    Dec 29, 2010
    1,493
    372
    A logic level MOSFET or 2N7000 should work.

    Allen
     
  11. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
    PB, you really make mistake this time.

    Please see the page 3 for port 1:
    The Port 1 output buffers can sink 20 mA and can drive LED displays directly. When 1s are written to Port 1 pins.
    AT89C2051.
     
  12. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
    Could you attach your circuit.
     
  13. Papabravo

    Expert

    Feb 24, 2006
    10,148
    1,791
    That is what I said Scott. After checking the datasheet, I realized that the sink capability had been upgraded from the standard 8051 architecture. They still cannot source enough current to drive an LED. That part of the pin architecture is still the same quasi bi-directional port of old.
     
  14. Papabravo

    Expert

    Feb 24, 2006
    10,148
    1,791
    What does your answer have to do with "registries"?
     
  15. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
    The port 1 are enough current to output 0 to sink the led as : sink 0 ← led ← R ← +5V
    And also enough current to output 1 to drive the led as : output 1 → R → led → Gnd.
     
  16. Papabravo

    Expert

    Feb 24, 2006
    10,148
    1,791
    C'mon Scott I admitted you were right about the ability to sink current. How is 80μA enough source current to drive an LED?
     
  17. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
    Oh, oh, sorry, this time you are right, I' was wrong, although I said that you was wrong, but I still felt that very strange how can you make a mistake like this, so I went to searched the application circuits, and the output port 1 same with port 0, only used the sink function, no any applications output high, so that was I didn't read the datasheet very carefully, when you replied and I checked it again and I found that I was missed something. (I'm talking with some friends with LINE(smartphone) to discussing the problem of voltage responding speed of ut61e multimeter and some other multimeters right now, and we had been discussed for hours)
     
  18. Papabravo

    Expert

    Feb 24, 2006
    10,148
    1,791
    No need to apologize, I made the first mistake by assuming that the part (89C2051) was an 8051 "compatible" part. I struggled with the limitations of the AT89C51CC01 & AT89C51CC03 which were otherwise perfect for my purposes except for the limited drive capability of the outputs. We used numerous transistor buffers in those designs.
     
  19. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
    The hdd of the computer that I usually using was damaged, so I have to use another computer to create a new environment to use, I will be through a hard time.

    I'm first times to see the AT89C51CC01 & AT89C51CC03.
     
  20. Papabravo

    Expert

    Feb 24, 2006
    10,148
    1,791
    We used them to build components for factory automation systems. The network was DeviceNet, and we had various combination of Digital Input, Digital Output(High Side and Low Side), Analog Input and Analog Output along with implementations of the required DeviceNet Objects. We used a substantial portion of the onboard flash memory for those devices.
     
Loading...