foto 1 : bagian atas dari alat · the at89c2051 provides the following standard features: 2k bytes...

40
A- 1 Foto 1 : Bagian Atas dari Alat Foto 2 : Bagian Depan dari Alat

Upload: others

Post on 10-Mar-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

A-1

Foto 1 : Bagian Atas dari Alat

Foto 2 : Bagian Depan dari Alat

Page 2: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

A-2

Foto 3 : Bagian Dalam dari Alat

Page 3: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector
Page 4: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

MCUV.ASM;-- Display Port & RAMs --; DisDat EQU P1 PS1 BIT P3.0 PS2 BIT P3.1 PS3 BIT P3.2 PS4 BIT P3.3 dg1 EQU 08h dg2 EQU 09h dg3 EQU 0Ah dg4 EQU 0Bh

APar2 EQU 0Ch APar1 EQU 0Dh SPar2 EQU 0Eh SPar1 EQU 0Fh MPar2 EQU 10h MPar1 EQU 11h DPar2 EQU 12h DPar1 EQU 13h

RBak2 EQU 14h RBak1 EQU 15h

J1_2 EQU 16h J1_1 EQU 17h J2_2 EQU 18h J2_1 EQU 19h

p50ms EQU 20h FLAG EQU 21h Sdh5 BIT FLAG.0;-- Others Port & RAMs --; SOut BIT P3.4 SIn BIT P3.5 Button BIT P3.7

;------------------------------------------------------------------------------org 00h jmp mulaiorg 0Bh jmp T0_Vect

;------------------------------------------------------------------------------mulai: ;-- Inisialisasi Var& Port mov SP, #22h mov DisDat, #0FFh setb PS1 setb PS2 setb PS3 setb PS4 setb SOut setb SIn mov dg4, #10h mov dg3, #10h mov dg2, #10h mov dg1, #10h ;-- Inisialisasi Timer mov TMOD, #51h clr TR1 clr TR0 clr ET1 clr ET0 ulang:

Page 1

Page 5: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

MCUV.ASM ;--- Tembakan Pertama mov TH0, #00h mov TL0, #00h mov TH1, #00h mov TL1, #00h clr TF0 setb TR1 setb TR0 mov b, #40 ambil_frek: cpl SOut nop nop nop nop nop nop nop nop nop djnz b, ambil_frek ;--- tunggu: mov a, TL1 jnz dapat jnb TF0, tunggu clr TR1 clr TR0 jmp ulang dapat: clr TR0 clr TR1 ;--- Simpan Jarak-1 mov J1_2, TH0 mov J1_1, TL0

;--- Tunggu 500 ms clr Sdh5 mov TH0, #03Ch mov TL0, #0B0h mov p50ms, #10 setb TR0 setb ET0 setb EA dly500ms: call show7s jnb Sdh5, dly500ms; mov R0, #10 ; 1 ( R0 = x ); dly500ms_1:; mov R1, #100 ; x ( R1 = y ); dly500ms_2:; mov R2, #245 ; y*x ( R2 = z ); djnz R2, $ ; 2*z*y*x; djnz R1, dly500ms_2 ; 2*y*x; djnz R0, dly500ms_1 ; 2*x ;--- Tembakan Kedua mov TH0, #00h mov TL0, #00h mov TH1, #00h mov TL1, #00h clr TF0 setb TR1 setb TR0

Page 2

Page 6: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

MCUV.ASM mov b, #40 ambil_frek2: cpl SOut nop nop nop nop nop nop nop nop nop djnz b, ambil_frek2 ;--- tunggu2: mov a, TL1 jnz dapat2 jnb TF0, tunggu2 clr TR1 clr TR0 jmp ulang dapat2: clr TR0 clr TR1 ;--- Hitung Jarak-2 mov dph, TH0 mov dpl, TL0 mov DPar2, #0 mov DPar1, #125 call div_int

mov MPar2, #0 mov MPar1, #2 call mul_int mov J2_2, dph mov J2_1, dpl

;--- Hitung Jarak-1 mov dph, J1_2 mov dpl, J1_1 mov DPar2, #0 mov DPar1, #125 call div_int

mov MPar2, #0 mov MPar1, #2 call mul_int mov J1_2, dph mov J1_1, dpl ;-- Cek Mana Yang Besar mov a, J2_2 clr c subb a, J1_2 jc J2_Lebih_Kecil jnz J2_Lebih_Besar

mov a, J2_1 clr c subb a, J1_1 jc J2_Lebih_Kecil jnz J2_Lebih_Besar

;-- Jarak Sama, V = cm/sPage 3

Page 7: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

MCUV.ASM mov dg4, #0 mov dg3, #0 mov dg2, #0 mov dg1, #0 jmp ulang

J2_Lebih_Kecil: mov dph, J1_2 mov dpl, J1_1 mov SPar2, J2_2 mov SPar1, J2_1 call subb_int jmp Ubah_KeDesimal

J2_Lebih_Besar: mov dph, J2_2 mov dpl, J2_1 mov SPar2, J1_2 mov SPar1, J1_1 call subb_int

Ubah_KeDesimal: ;-- Kali 2 Dulu mov MPar2, #0 mov MPar1, #2 call mul_int ;-- Yang akan ditampilkan mov RBak2, dph ; Rb-Rs-Pl-St mov RBak1, dpl ; Ambil Ribuan mov DPar2, #003h mov DPar1, #0E8h call div_int ; Rb-Rs-Pl-St/1000 = Rb mov dg4, dpl ; Get <Rb> ; Ambil ratusan mov MPar2, #003h mov MPar1, #0E8h call mul_int ; Rb*1000 mov SPar2, dph mov SPar1, dpl mov dph, RBak2 mov dpl, RBak1 call subb_int ; Rb-Rs-Pl-St - Rb*1000 = Rs-Pl-St mov RBak2, dph ; Rs-Pl-St mov RBak1, dpl

mov DPar2, #0 mov DPar1, #100 call div_int ; Rs-Pl-St/100 = Rs mov dg3, dpl ; Get <Rs> ; Ambil Puluhan mov MPar2, #0 mov MPar1, #100 call mul_int ; Rs*100 mov SPar2, dph mov SPar1, dpl mov dph, RBak2 mov dpl, RBak1 call subb_int ; Rs-Pl-St - Rs*100 = Pl-St

mov RBak2, dph ; Pl-St mov RBak1, dpl

Page 4

Page 8: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

MCUV.ASM

mov DPar2, #0 mov DPar1, #10 call div_int ; Pl-St/10 = Pl mov dg2, dpl ; Get <Pl> ; Ambil Satuan mov MPar2, #0 mov MPar1, #10 call mul_int ; Pl*10 mov SPar2, dph mov SPar1, dpl mov dph, RBak2 mov dpl, RBak1 call subb_int ; Pl-St - Pl*10 = St

mov dg1, dpl ; Get <St>

jmp ulang

;------------------------------------------------------------------------------T0_Vect: push psw clr TR0 mov TH0, #03Ch mov TL0, #0B0h setb TR0 djnz p50ms, T0_Vect_End clr TR0 clr ET0 clr EA setb Sdh5 T0_Vect_End: pop psw reti

;------------------------------------------------------------------------------dly_key: ;-- Delay Sampai Tombol Dilepas push 0h push 1h dk_ulang: mov R0, #200 dly_key_: call show7s djnz R0, dly_key_ jnb Button, dk_ulang pop 1h pop 0h ret

;------------------------------------------------------------------------------show7s: ;-- Tampilkan Angka Ke Display push acc push 0h mov dptr, #db7s ;-- Show Digit-4 mov a, dg4 movc a, @a+dptr mov DisDat, a clr PS4 call dly7s setb PS4 ;-- Show Digit-3

Page 5

Page 9: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

MCUV.ASM mov a, dg3 movc a, @a+dptr mov DisDat, a clr PS3 call dly7s setb PS3 ;-- Show Digit-2 mov a, dg2 movc a, @a+dptr mov DisDat, a clr PS2 call dly7s setb PS2 ;-- Show Digit-1 mov a, dg1 movc a, @a+dptr mov DisDat, a clr PS1 call dly7s setb PS1 pop 0h pop acc retdly7s: ;-- Delay Tahan mov R0, #100 djnz R0, $ retdb7s: ;-- Data Base Kombinasi Segmen; -gfedcba db 11000000b ; 0 db 11111001b ; 1 db 10100100b ; 2 db 10110000b ; 3 db 10011001b ; 4 db 10010010b ; 5 db 10000010b ; 6 db 11111000b ; 7 db 10000000b ; 8 db 10010000b ; 9 db 10001000b ; A db 10000011b ; B db 11000110b ; C db 10100001b ; D db 10000110b ; E db 10001110b ; F db 11111111b ; Blank (17)

;-------------------------------------------------------------------------------;add_int: ; [DPH:DPL] + [APar2:APar1] -> [DPH:DPL] push acc mov a, APar1 add a, dpl mov dpl, a mov a, APar2 addc a, dph mov dph, a pop acc ret

;-------------------------------------------------------------------------------;subb_int:

Page 6

Page 10: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

MCUV.ASM ; [DPH:DPL] - [SPar2:SPar1] -> [DPH:DPL] push acc clr c mov a, dpl subb a, SPar1 mov dpl, a mov a, dph subb a, SPar2 mov dph, a pop acc ret

;-------------------------------------------------------------------------------;mul_int: ; [DPH:DPL] X [MPar2:MPar1] -> [DPH:DPL] push acc push b mov a, dpl mov b, MPar1 mul ab xch a, dpl push b mov b, MPar2 mul ab pop b add a, b xch a, dph mov b, MPar1 mul ab add a, dph mov dph, a pop b pop acc ret

;-------------------------------------------------------------------------------;div_int: ; [DPH:DPL] / [DPar2:DPar1] -> [DPH:DPL] push acc push b push 2h push 3h push 4h mov r2, #16 clr a mov r3, a mov r4, a di_loop: mov a, dpl add a, acc mov dpl, a mov a, dph rlc a mov dph, a mov a, r3 rlc a mov r3, a mov a, r4 rlc a mov r4, a mov a, r3 subb a, DPar1 mov b, a mov a, r4

Page 7

Page 11: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

MCUV.ASM subb a, DPar2 jc di_smaller mov r4, a mov r3, b orl dpl, #1 di_smaller: djnz r2, di_loop pop 4h pop 3h pop 2h pop b pop acc ret

end

Page 8

Page 12: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

1

Pin Configuration

PDIP/SOIC

12345678910

20191817161514131211

RST/VPP(RXD) P3.0(TXD) P3.1

XTAL2XTAL1

(INT0) P3.2(INT1) P3.3

(TO) P3.4(T1) P3.5

GND

VCCP1.7P1.6P1.5P1.4P1.3P1.2P1.1 (AIN1)P1.0 (AIN0)P3.7

Features• Compatible with MCS-51™ Products• 2K Bytes of Reprogrammable Flash Memory

– Endurance: 1,000 Write/Erase Cycles• 2.7V to 6V Operating Range• Fully Static Operation: 0 Hz to 24 MHz• Two-level Program Memory Lock• 128 x 8-bit Internal RAM• 15 Programmable I/O Lines• Two 16-bit Timer/Counters• Six Interrupt Sources• Programmable Serial UART Channel• Direct LED Drive Outputs• On-chip Analog Comparator• Low-power Idle and Power-down Modes

DescriptionThe AT89C2051 is a low-voltage, high-performance CMOS 8-bit microcomputer with2K bytes of Flash programmable and erasable read only memory (PEROM). Thedevice is manufactured using Atmel’s high-density nonvolatile memory technologyand is compatible with the industry-standard MCS-51 instruction set. By combining aversatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C2051 is a power-ful microcomputer which provides a highly-flexible and cost-effective solution to manyembedded control applications.

The AT89C2051 provides the following standard features: 2K bytes of Flash, 128bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector two-level interruptarchitecture, a full duplex serial port, a precision analog comparator, on-chip oscillatorand clock circuitry. In addition, the AT89C2051 is designed with static logic for opera-tion down to zero frequency and supports two software selectable power savingmodes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serialport and interrupt system to continue functioning. The power-down mode saves theRAM contents but freezes the oscillator disabling all other chip functions until the nexthardware reset.

Rev. 0368E–02/00

8-bit Microcontroller with 2K Bytes Flash

AT89C2051

Page 13: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

AT89C20512

Block Diagram

Page 14: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

AT89C2051

3

Pin Description

VCC

Supply voltage.

GND

Ground.

Port 1

Port 1 is an 8-bit bi-irectional I/O port. Port pins P1.2 toP1.7 provide internal pullups. P1.0 and P1.1 require exter-nal pullups. P1.0 and P1.1 also serve as the positive input(AIN0) and the negative input (AIN1), respectively, of theon-chip precision analog comparator. The Port 1 outputbuffers can sink 20 mA and can drive LED displays directly.When 1s are written to Port 1 pins, they can be used asinputs. When pins P1.2 to P1.7 are used as inputs and areexternally pulled low, they will source current (IIL) becauseof the internal pullups.

Port 1 also receives code data during Flash programmingand verification.

Port 3

Port 3 pins P3.0 to P3.5, P3.7 are seven bi-irectional I/Opins with internal pullups. P3.6 is hard-wired as an input tothe output of the on-chip comparator and is not accessibleas a general purpose I/O pin. The Port 3 output buffers cansink 20 mA. When 1s are written to Port 3 pins they arepulled high by the internal pullups and can be used asinputs. As inputs, Port 3 pins that are externally beingpulled low will source current (IIL) because of the pullups.

Port 3 also serves the functions of various special featuresof the AT89C2051 as listed below:

Port 3 also receives some control signals for Flash pro-gramming and verification.

RST

Reset input. All I/O pins are reset to 1s as soon as RSTgoes high. Holding the RST pin high for two machinecycles while the oscillator is running resets the device.

Each machine cycle takes 12 oscillator or clock cycles.

XTAL1

Input to the inverting oscillator amplifier and input to theinternal clock operating circuit.

XTAL2

Output from the inverting oscillator amplifier.

Oscillator Characteristics XTAL1 and XTAL2 are the input and output, respectively,of an inverting amplifier which can be configured for use asan on-chip oscillator, as shown in Figure 1. Either a quartzcrystal or ceramic resonator may be used. To drive thedevice from an external clock source, XTAL2 should be leftunconnected while XTAL1 is driven as shown in Figure 2.There are no requirements on the duty cycle of the externalclock signal, since the input to the internal clocking circuitryis through a divide-by-two flip-flop, but minimum and maxi-mum voltage high and low time specifications must beobserved.

Figure 1. Oscillator Connections

Note: C1, C2 = 30 pF ± 10 pF for Crystals= 40 pF ± 10 pF for Ceramic Resonators

Figure 2. External Clock Drive Configuration

Port Pin Alternate Functions

P3.0 RXD (serial input port)

P3.1 TXD (serial output port)

P3.2 INT0 (external interrupt 0)

P3.3 INT1 (external interrupt 1)

P3.4 T0 (timer 0 external input)

P3.5 T1 (timer 1 external input)

Page 15: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

AT89C20514

Special Function RegistersA map of the on-chip memory area called the Special Func-tion Register (SFR) space is shown in the table below.

Note that not all of the addresses are occupied, and unoc-cupied addresses may not be implemented on the chip.Read accesses to these addresses will in general return

random data, and write accesses will have an indetermi-nate effect.

User software should not write 1s to these unlisted loca-tions, since they may be used in future products to invokenew features. In that case, the reset or inactive values ofthe new bits will always be 0.

Table 1. AT89C2051 SFR Map and Reset Values

0F8H 0FFH

0F0H B00000000

0F7H

0E8H 0EFH

0E0H ACC00000000

0E7H

0D8H 0DFH

0D0H PSW00000000

0D7H

0C8H 0CFH

0C0H 0C7H

0B8H IPXXX00000

0BFH

0B0H P311111111

0B7H

0A8H IE0XX00000

0AFH

0A0H 0A7H

98H SCON00000000

SBUFXXXXXXXX

9FH

90H P111111111

97H

88H TCON00000000

TMOD00000000

TL000000000

TL100000000

TH000000000

TH100000000

8FH

80H SP00000111

DPL00000000

DPH00000000

PCON0XXX0000

87H

Page 16: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

AT89C2051

5

Restrictions on Certain Instructions The AT89C2051 and is an economical and cost-effectivemember of Atmel’s growing family of microcontrollers. Itcontains 2K bytes of flash program memory. It is fully com-patible with the MCS-51 architecture, and can beprogrammed using the MCS-51 instruction set. However,there are a few considerations one must keep in mindwhen utilizing certain instructions to program this device.

All the instructions related to jumping or branching shouldbe restricted such that the destination address falls withinthe physical program memory space of the device, which is2K for the AT89C2051. This should be the responsibility ofthe software programmer. For example, LJMP 7E0Hwould be a valid instruction for the AT89C2051 (with 2K ofmemory), whereas LJMP 900H would not.

1. Branching instructions:

LCALL, LJMP, ACALL, AJMP, SJMP, JMP @A+DPTR

These unconditional branching instructions will executecorrectly as long as the programmer keeps in mind that thedestination branching address must fall within the physicalboundaries of the program memory size (locations 00H to7FFH for the 89C2051). Violating the physical space limitsmay cause unknown program behavior.

CJNE [...], DJNZ [...], JB, JNB, JC, JNC, JBC, JZ, JNZ Withthese conditional branching instructions the same ruleabove applies. Again, violating the memory boundariesmay cause erratic execution.

For applications involving interrupts the normal interruptservice routine address locations of the 80C51 family archi-tecture have been preserved.

2. MOVX-related instructions, Data Memory:

The AT89C2051 contains 128 bytes of internal data mem-ory. Thus, in the AT89C2051 the stack depth is limited to128 bytes, the amount of available RAM. External DATAmemory access is not supported in this device, nor is exter-nal PROGRAM memory execution. Therefore, no MOVX[...] instructions should be included in the program.

A typical 80C51 assembler will still assemble instructions,even if they are written in violation of the restrictions men-tioned above. It is the responsibility of the controller user toknow the physical features and limitations of the devicebe ing used and ad jus t the i ns t ruc t i ons usedcorrespondingly.

Program Memory Lock BitsOn the chip are two lock bits which can be left unpro-grammed (U) or can be programmed (P) to obtain theadditional features listed in the table below:

Lock Bit Protection Modes(1)

Note: 1. The Lock Bits can only be erased with the Chip Erase operation.

Idle Mode In idle mode, the CPU puts itself to sleep while all the on-chip peripherals remain active. The mode is invoked bysoftware. The content of the on-chip RAM and all the spe-cial functions registers remain unchanged during thismode. The idle mode can be terminated by any enabledinterrupt or by a hardware reset.

P1.0 and P1.1 should be set to “0” if no external pullups areused, or set to “1” if external pullups are used.

It should be noted that when idle is terminated by a hard-ware reset, the device normally resumes programexecution, from where it left off, up to two machine cyclesbefore the internal reset algorithm takes control. On-chiphardware inhibits access to internal RAM in this event, butaccess to the port pins is not inhibited. To eliminate thepossibility of an unexpected write to a port pin when Idle isterminated by reset, the instruction following the one thatinvokes Idle should not be one that writes to a port pin or toexternal memory.

Power-down Mode In the power down mode the oscillator is stopped, and theinstruction that invokes power down is the last instructionexecuted. The on-chip RAM and Special Function Regis-ters retain their values until the power down mode isterminated. The only exit from power down is a hardwarereset. Reset redefines the SFRs but does not change theon-chip RAM. The reset should not be activated before VCCis restored to its normal operating level and must be heldactive long enough to allow the oscillator to restart andstabilize.

P1.0 and P1.1 should be set to “0” if no external pullups areused, or set to “1” if external pullups are used.

Program Lock Bits

LB1 LB2 Protection Type

1 U U No program lock features.

2 P U Further programming of the Flash is disabled.

3 P P Same as mode 2, also verify is disabled.

Page 17: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

AT89C20516

Programming The FlashThe AT89C2051 is shipped with the 2K bytes of on-chipPEROM code memory array in the erased state (i.e., con-tents = FFH) and ready to be programmed. The codememory array is programmed one byte at a time. Once thearray is programmed, to re-program any non-blank byte,the entire memory array needs to be erased electrically.

Internal Address Counter: The AT89C2051 contains aninternal PEROM address counter which is always reset to000H on the rising edge of RST and is advanced by apply-ing a positive going pulse to pin XTAL1.

Programming Algorithm: To program the AT89C2051,the following sequence is recommended.1. Power-up sequence:

Apply power between VCC and GND pinsSet RST and XTAL1 to GND

2. Set pin RST to “H”Set pin P3.2 to “H”

3. Apply the appropriate combination of “H” or “L” logic levels to pins P3.3, P3.4, P3.5, P3.7 to select one of the programming operations shown in the PEROM Pro-gramming Modes table.

To Program and Verify the Array:4. Apply data for Code byte at location 000H to P1.0 to

P1.7.5. Raise RST to 12V to enable programming.6. Pulse P3.2 once to program a byte in the PEROM array

or the lock bits. The byte-write cycle is self-timed and typically takes 1.2 ms.

7. To verify the programmed data, lower RST from 12V to logic “H” level and set pins P3.3 to P3.7 to the appropiate levels. Output data can be read at the port P1 pins.

8. To program a byte at the next address location, pulse XTAL1 pin once to advance the internal address counter. Apply new data to the port P1 pins.

9. Repeat steps 5 through 8, changing data and advancing the address counter for the entire 2K bytes array or until the end of the object file is reached.

10.Power-off sequence:set XTAL1 to “L”set RST to “L”Turn VCC power off

Data Polling: The AT89C2051 features Data Polling toindicate the end of a write cycle. During a write cycle, anattempted read of the last byte written will result in the com-plement of the written data on P1.7. Once the write cyclehas been completed, true data is valid on all outputs, and

the next cycle may begin. Data Polling may begin any timeafter a write cycle has been initiated.

Ready/Busy: The Progress of byte programming can alsobe monitored by the RDY/BSY output signal. Pin P3.1 ispulled low after P3.2 goes High during programming to indi-cate BUSY. P3.1 is pulled High again when programming isdone to indicate READY.

Program Verify: If lock bits LB1 and LB2 have not beenprogrammed code data can be read back via the data linesfor verification:1. Reset the internal address counter to 000H by bringing

RST from “L” to “H”.2. Apply the appropriate control signals for Read Code data

and read the output data at the port P1 pins.3. Pulse pin XTAL1 once to advance the internal address

counter.4. Read the next code data byte at the port P1 pins.5. Repeat steps 3 and 4 until the entire array is read.

The lock bits cannot be verified directly. Verification of thelock bits is achieved by observing that their features areenabled.

Chip Erase: The entire PEROM array (2K bytes) and thetwo Lock Bits are erased electrically by using the propercombination of control signals and by holding P3.2 low for10 ms. The code array is written with all “1”s in the ChipErase operation and must be executed before any non-blank memory byte can be re-programmed.

Reading the Signature Bytes: The signature bytes areread by the same procedure as a normal verification oflocations 000H, 001H, and 002H, except that P3.5 andP3.7 must be pulled to a logic low. The values returned areas follows.

(000H) = 1EH indicates manufactured by Atmel(001H) = 21H indicates 89C2051

Programming InterfaceEvery code byte in the Flash array can be written and theentire array can be erased by using the appropriate combi-nation of control signals. The write operation cycle is self-timed and once initiated, will automatically time itself tocompletion.

All major programming vendors offer worldwide support forthe Atmel microcontroller series. Please contact your localprogramming vendor for the appropriate software revision.

Page 18: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

AT89C2051

7

Notes: 1. The internal PEROM address counter is reset to 000H on the rising edge of RST and is advanced by a positive pulse at XTAL 1 pin.

2. Chip Erase requires a 10 ms PROG pulse.3. P3.1 is pulled Low during programming to indicate RDY/BSY.

Figure 3. Programming the Flash Memory Figure 4. Verifying the Flash Memory

Flash Programming ModesMode RST/VPP P3.2/PROG P3.3 P3.4 P3.5 P3.7

Write Code Data(1)(3) 12V L H H H

Read Code Data(1) H H L L H H

Write Lock Bit - 1 12V H H H H

Bit - 2 12V H H L L

Chip Erase 12V H L L L

Read Signature Byte H H L L L L

(2)

PP

Page 19: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

AT89C20518

Note: 1. Only used in 12-volt programming mode.

Flash Programming and Verification Waveforms

Flash Programming and Verification Characteristics TA = 0°C to 70°C, VCC = 5.0 ± 10%

Symbol Parameter Min Max Units

VPP Programming Enable Voltage 11.5 12.5 V

IPP Programming Enable Current 250 µA

tDVGL Data Setup to PROG Low 1.0 µs

tGHDX Data Hold after PROG 1.0 µs

tEHSH P3.4 (ENABLE) High to VPP 1.0 µs

tSHGL VPP Setup to PROG Low 10 µs

tGHSL VPP Hold after PROG 10 µs

tGLGH PROG Width 1 110 µs

tELQV ENABLE Low to Data Valid 1.0 µs

tEHQZ Data Float after ENABLE 0 1.0 µs

tGHBL PROG High to BUSY Low 50 ns

tWC Byte Write Cycle Time 2.0 ms

tBHIH RDY/BSY\ to Increment Clock Delay 1.0 µs

tIHIL Increment Clock High 200 ns

Page 20: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

AT89C2051

9

Notes: 1. Under steady state (non-transient) conditions, IOL must be externally limited as follows:Maximum IOL per port pin: 20 mAMaximum total IOL for all output pins: 80 mAIf IOL exceeds the test condition, VOL may exceed the related specification. Pins are not guaranteed to sink current greater than the listed test conditions.

2. Minimum VCC for Power-down is 2V.

Absolute Maximum Ratings*Operating Temperature ................................. -55°C to +125°C *NOTICE: Stresses beyond those listed under “Absolute

Maximum Ratings” may cause permanent dam-age to the device. This is a stress rating only and functional operation of the device at these or any other conditions beyond those indicated in the operational sections of this specification is not implied. Exposure to absolute maximum rating conditions for extended periods may affect device reliability.

Storage Temperature ..................................... -65°C to +150°C

Voltage on Any Pinwith Respect to Ground .....................................-1.0V to +7.0V

Maximum Operating Voltage ............................................ 6.6V

DC Output Current...................................................... 25.0 mA

DC CharacteristicsTA = -40°C to 85°C, VCC = 2.0V to 6.0V (unless otherwise noted)

Symbol Parameter Condition Min Max Units

VIL Input Low-voltage -0.5 0.2 VCC - 0.1 V

VIH Input High-voltage (Except XTAL1, RST) 0.2 VCC + 0.9 VCC + 0.5 V

VIH1 Input High-voltage (XTAL1, RST) 0.7 VCC VCC + 0.5 V

VOL Output Low-voltage(1)

(Ports 1, 3)IOL = 20 mA, VCC = 5VIOL = 10 mA, VCC = 2.7V

0.5 V

VOH Output High-voltage(Ports 1, 3)

IOH = -80 µA, VCC = 5V ± 10% 2.4 V

IOH = -30 µA 0.75 VCC V

IOH = -12 µA 0.9 VCC V

IIL Logical 0 Input Current(Ports 1, 3)

VIN = 0.45V -50 µA

ITL Logical 1 to 0 Transition Current (Ports 1, 3)

VIN = 2V, VCC = 5V ± 10% -750 µA

ILI Input Leakage Current (Port P1.0, P1.1)

0 < VIN < VCC ±10 µA

VOS Comparator Input Offset Voltage VCC = 5V 20 mV

VCM Comparator Input Common Mode Voltage

0 VCC V

RRST Reset Pull-down Resistor 50 300 KΩ

CIO Pin Capacitance Test Freq. = 1 MHz, TA = 25°C 10 pF

ICC Power Supply Current Active Mode, 12 MHz, VCC = 6V/3V 15/5.5 mA

Idle Mode, 12 MHz, VCC = 6V/3V P1.0 & P1.1 = 0V or VCC

5/1 mA

Power-down Mode(2) VCC = 6V P1.0 & P1.1 = 0V or VCC 100 µA

VCC = 3V P1.0 & P1.1 = 0V or VCC 20 µA

Page 21: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

AT89C205110

External Clock Drive Waveforms

External Clock Drive

Symbol Parameter

VCC = 2.7V to 6.0V VCC = 4.0V to 6.0V

UnitsMin Max Min Max

1/tCLCL Oscillator Frequency 0 12 0 24 MHz

tCLCL Clock Period 83.3 41.6 ns

tCHCX High Time 30 15 ns

tCLCX Low Time 30 15 ns

tCLCH Rise Time 20 20 ns

tCHCL Fall Time 20 20 ns

Page 22: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

AT89C2051

11

()

Shift Register Mode Timing Waveforms

AC Testing Input/Output Waveforms(1)

Note: 1. AC Inputs during testing are driven at VCC - 0.5V for a logic 1 and 0.45V for a logic 0. Timing measurements are made at VIH min. for a logic 1 and VIL max. for a logic 0.

Float Waveforms(1)

Note: 1. For timing purposes, a port pin is no longer floating when a 100 mV change from load voltage occurs. A port pin begins to float when 100 mV change frothe loaded VOH/VOL level occurs.

Serial Port Timing: Shift Register Mode Test ConditionsVCC = 5.0V ± 20%; Load Capacitance = 80 pF

Symbol Parameter

12 MHz Osc Variable Oscillator

UnitsMin Max Min Max

tXLXL Serial Port Clock Cycle Time 1.0 12tCLCL µs

tQVXH Output Data Setup to Clock Rising Edge 700 10tCLCL-133 ns

tXHQX Output Data Hold after Clock Rising Edge 50 2tCLCL-117 ns

tXHDX Input Data Hold after Clock Rising Edge 0 0 ns

tXHDV Clock Rising Edge to Input Data Valid 700 10tCLCL-133 ns

Page 23: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

AT89C205112

AT89C2051TYPICAL ICC - ACTIVE (85°C)

0

5

10

15

20

0 6 12 18 24

FREQUENCY (MHz)

ICC

mA

Vcc=6.0V

Vcc=5.0V

Vcc=3.0V

AT89C2051TYPICAL ICC - IDLE (85°C)

0

1

2

3

0 3 6 9 12

FREQUENCY (MHz)

ICC

mA

Vcc=6.0V

Vcc=5.0V

Vcc=3.0V

AT89C2051TYPICAL ICC vs. VOLTAGE- POWER DOWN (85°C)

0

5

10

15

20

3.0V 4.0V 5.0V 6.0V

Vcc VOLTAGE

ICC

µA

Notes: 1. XTAL1 tied to GND for ICC (power-down)2. P.1.0 and P1.1 = VCC or GND3. Lock bits programmed

Page 24: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

AT89C2051

13

Ordering Information

Speed(MHz)

PowerSupply Ordering Code Package Operation Range

12 2.7V to 6.0V AT89C2051-12PC

AT89C2051-12SC

20P3

20S

Commercial

(0°C to 70°C)

AT89C2051-12PI

AT89C2051-12SI

20P3

20S

Industrial

(-40°C to 85°C)

24 4.0V to 6.0V AT89C2051-24PC

AT89C2051-24SC

20P3

20S

Commercial

(0°C to 70°C)

AT89C2051-24PI

AT89C2051-24SI

20P3

20S

Industrial

(-40°C to 85°C)

Package Type

20P3 20-lead, 0.300” Wide, Plastic Dual In-line Package (PDIP)

20S 20-lead, 0.300” Wide, Plastic Gull Wing Small Outline (SOIC)

Page 25: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

AT89C205114

Packaging Information

1.060(26.9).980(24.9) PIN

1

.280(7.11)

.240(6.10)

.090(2.29)MAX

.005(.127)MIN

.015(.381) MIN

.022(.559)

.014(.356).070(1.78).045(1.13)

.325(8.26)

.300(7.62)

015

REF

.430(10.92) MAX

.014(.356)

.008(.203)

.110(2.79)

.090(2.29)

.150(3.81)

.115(2.92)

SEATINGPLANE

.210(5.33)MAX

.900(22.86) REF

0.299 (7.60)0.291 (7.39)

0.020 (0.508)0.013 (0.330)

0.420 (10.7)0.393 (9.98)

PIN 1

.050 (1.27) BSC

0.513 (13.0)0.497 (12.6)

0.012 (0.305)0.003 (0.076)

0.105 (2.67)0.092 (2.34)

08

REF

0.035 (0.889)0.015 (0.381)

0.013 (0.330)0.009 (0.229)

20P3, 20-lead, 0.300" Wide, Plastic Dual Inline Package (PDIP)Dimensions in Inches and (Millimeters)JEDEC STANDARD MS-001 AD

20S, 20-lead, 0.300" Wide, Plastic Gull WIng Small Outline (SOIC)Dimensions in Inches and (Millimeters)

Page 26: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

© Atmel Corporation 2000.Atmel Corporation makes no warranty for the use of its products, other than those expressly contained in the Company’s standard war-ranty which is detailed in Atmel’s Terms and Conditions located on the Company’s web site. The Company assumes no responsibility forany errors which may appear in this document, reserves the right to change devices or specifications detailed herein at any time withoutnotice, and does not make any commitment to update the information contained herein. No licenses to patents or other intellectual prop-erty of Atmel are granted by the Company in connection with the sale of Atmel products, expressly or by implication. Atmel’s products arenot authorized for use as critical components in life support devices or systems.

Atmel Headquarters Atmel Operations

Corporate Headquarters2325 Orchard ParkwaySan Jose, CA 95131TEL (408) 441-0311FAX (408) 487-2600

EuropeAtmel U.K., Ltd.Coliseum Business CentreRiverside WayCamberley, Surrey GU15 3YLEnglandTEL (44) 1276-686-677FAX (44) 1276-686-697

AsiaAtmel Asia, Ltd.Room 1219Chinachem Golden Plaza77 Mody Road TsimhatsuiEast KowloonHong KongTEL (852) 2721-9778FAX (852) 2722-1369

JapanAtmel Japan K.K.9F, Tonetsu Shinkawa Bldg.1-24-8 ShinkawaChuo-ku, Tokyo 104-0033JapanTEL (81) 3-3523-3551FAX (81) 3-3523-7581

Atmel Colorado Springs1150 E. Cheyenne Mtn. Blvd.Colorado Springs, CO 80906TEL (719) 576-3300FAX (719) 540-1759

Atmel RoussetZone Industrielle13106 Rousset CedexFranceTEL (33) 4-4253-6000FAX (33) 4-4253-6001

Fax-on-DemandNorth America:1-(800) 292-8635

International:1-(408) 441-0732

[email protected]

Web Sitehttp://www.atmel.com

BBS1-(408) 436-4309

Printed on recycled paper.

0368E–02/00/xM

Marks bearing ® and/or ™ are registered trademarks and trademarks of Atmel Corporation.

Terms and product names in this document may be trademarks of others.

Page 27: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

Semiconductor Components Industries, LLC, 2004

July, 2004 − Rev. 181 Publication Order Number:

LM358/D

LM358, LM258, LM2904,LM2904A, LM2904V,NCV2904

Single Supply DualOperational Amplifiers

Utilizing the circuit designs perfected for Quad OperationalAmplifiers, these dual operational amplifiers feature low power drain,a common mode input voltage range extending to ground/VEE, andsingle supply or split supply operation. The LM358 series isequivalent to one−half of an LM324.

These amplifiers have several distinct advantages over standardoperational amplifier types in single supply applications. They canoperate at supply voltages as low as 3.0 V or as high as 32 V, withquiescent currents about one−fifth of those associated with theMC1741 (on a per amplifier basis). The common mode input rangeincludes the negative supply, thereby eliminating the necessity forexternal biasing components in many applications. The output voltagerange also includes the negative power supply voltage.

Features

• Short Circuit Protected Outputs

• True Differential Input Stage

• Single Supply Operation: 3.0 V to 32 V

• Low Input Bias Currents

• Internally Compensated

• Common Mode Range Extends to Negative Supply

• Single and Split Supply Operation

• ESD Clamps on the Inputs Increase Ruggedness of the Devicewithout Affecting Operation

• Pb−Free Packages are Available

• NCV Prefix for Automotive and Other Applications Requiring Siteand Control Changes

PDIP−8N, AN, VN SUFFIX

CASE 626

1

8

SOIC−8D, VD SUFFIX

CASE 7511

8

PIN CONNECTIONS

VEE/Gnd

Inputs A

Inputs B

Output B

Output A VCC

−+

+

1

2

3

4

8

7

6

5

(Top View)

See general marking information in the device markingsection on page 11 of this data sheet.

DEVICE MARKING INFORMATION

See detailed ordering and shipping information in the packagedimensions section on page 10 of this data sheet.

ORDERING INFORMATION

Micro8

DMR2 SUFFIXCASE 846A

1

8

http://onsemi.com

Page 28: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

LM358, LM258, LM2904, LM2904A, LM2904V, NCV2904

http://onsemi.com2

Single Supply Split Supplies

VCC

VEE/Gnd

3.0 V to VCC(max)

1

2

VCC

1

2

VEE

1.5 V to VCC(max)

1.5 V to VEE(max)

Output

Bias CircuitryCommon to Both

Amplifiers

VCC

VEE/Gnd

Inputs

Q2

Q3 Q4

Q5

Q26

Q7

Q8

Q6

Q9

Q11

Q10Q1 2.4 k

Q25

Q22

40 k

Q13

Q14

Q15

Q16

Q19

5.0 pF

Q18

Q17

Q20

Q21

2.0 k

Q24

Q23

Q12

25

Figure 1.

Figure 2. Representative Schematic Diagram(One−Half of Circuit Shown)

Page 29: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

LM358, LM258, LM2904, LM2904A, LM2904V, NCV2904

http://onsemi.com3

MAXIMUM RATINGS (TA = +25°C, unless otherwise noted.)

Rating Symbol Value Unit

Power Supply VoltagesSingle SupplySplit Supplies

VCCVCC, VEE

32±16

Vdc

Input Differential Voltage Range (Note 1) VIDR ±32 Vdc

Input Common Mode Voltage Range (Note 2) VICR −0.3 to 32 Vdc

Output Short Circuit Duration tSC Continuous

Junction Temperature TJ 150 °C

Thermal Resistance, Junction−to−Air (Note 3) RJA 238 °C/W

Storage Temperature Range Tstg −55 to +125 °C

ESD Protection at any PinHuman Body ModelMachine Model

Vesd2000200

V

Operating Ambient Temperature RangeLM258LM358

LM2904/LM2904ALM2904V, NCV2904 (Note 4)

TA−25 to +850 to +70

−40 to +105−40 to +125

°C

Maximum ratings are those values beyond which device damage can occur. Maximum ratings applied to the device are individual stress limitvalues (not normal operating conditions) and are not valid simultaneously. If these limits are exceeded, device functional operation is not implied,damage may occur and reliability may be affected.1. Split Power Supplies.2. For Supply Voltages less than 32 V the absolute maximum input voltage is equal to the supply voltage.3. RJA for Case 846A.4. NCV2904 is qualified for automotive use.

Page 30: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

LM358, LM258, LM2904, LM2904A, LM2904V, NCV2904

http://onsemi.com4

ELECTRICAL CHARACTERISTICS (VCC = 5.0 V, VEE = GND, TA = 25°C, unless otherwise noted.)

LM258 LM358

Characteristic Symbol Min Typ Max Min Typ Max Unit

Input Offset VoltageVCC = 5.0 V to 30 V, VIC = 0 V to VCC −1.7 V,VO 1.4 V, RS = 0

VIO mV

TA = 25°C − 2.0 5.0 − 2.0 7.0TA = Thigh (Note 5) − − 7.0 − − 9.0TA = Tlow (Note 5) − − 7.0 − − 9.0

Average Temperature Coefficient of Input OffsetVoltage

VIO/T − 7.0 − − 7.0 − V/°C

TA = Thigh to Tlow (Note 5)

Input Offset Current IIO − 3.0 30 − 5.0 50 nATA = Thigh to Tlow (Note 5) − − 100 − − 150

Input Bias Current IIB − −45 −150 − −45 −250TA = Thigh to Tlow (Note 5) − −50 −300 − −50 −500

Average Temperature Coefficient of Input OffsetCurrent

IIO/T − 10 − − 10 − pA/°C

TA = Thigh to Tlow (Note 5)

Input Common Mode Voltage Range (Note 6),VCC = 30 V

VICR 0 − 28.3 0 − 28.3 V

VCC = 30 V, TA = Thigh to Tlow 0 − 28 0 − 28

Differential Input Voltage Range VIDR − − VCC − − VCC V

Large Signal Open Loop Voltage Gain AVOL V/mVRL = 2.0 k, VCC = 15 V, For Large VO Swing, 50 100 − 25 100 −TA = Thigh to Tlow (Note 5) 25 − − 15 − −

Channel Separation CS − −120 − − −120 − dB1.0 kHz ≤ f ≤ 20 kHz, Input Referenced

Common Mode Rejection CMR 70 85 − 65 70 − dB

RS ≤ 10 k

Power Supply Rejection PSR 65 100 − 65 100 − dB

Output Voltage−High Limit TA = Thigh to Tlow (Note 5)

VOH V

VCC = 5.0 V, RL = 2.0 k, TA = 25°C 3.3 3.5 − 3.3 3.5 −VCC = 30 V, RL = 2.0 k 26 − − 26 − −VCC = 30 V, RL = 10 k 27 28 − 27 28 −

Output Voltage−Low Limit VOL − 5.0 20 − 5.0 20 mVVCC = 5.0 V, RL = 10 k, TA = Thigh to Tlow (Note 5)

Output Source Current IO+ 20 40 − 20 40 − mAVID = +1.0 V, VCC = 15 V

Output Sink Current IO−VID = −1.0 V, VCC = 15 V 10 20 − 10 20 − mAVID = −1.0 V, VO = 200 mV 12 50 − 12 50 − A

Output Short Circuit to Ground (Note 7) ISC − 40 60 − 40 60 mA

Power Supply Current (Total Device)TA = Thigh to Tlow (Note 5)

ICC mA

VCC = 30 V, VO = 0 V, RL = ∞ − 1.5 3.0 − 1.5 3.0VCC = 5 V, VO = 0 V, RL = ∞ − 0.7 1.2 − 0.7 1.2

5. LM258: Tlow = −25°C, Thigh = +85°C LM358: Tlow = 0°C, Thigh = +70°CLM2904/LM2904A: Tlow = −40°C, Thigh = +105°C LM2904V & NCV2904: Tlow = −40°C, Thigh = +125°CNCV2904 is qualified for automotive use.

6. The input common mode voltage or either input signal voltage should not be allowed to go negative by more than 0.3 V. The upper end ofthe common mode voltage range is VCC − 1.7 V.

7. Short circuits from the output to VCC can cause excessive heating and eventual destruction. Destructive dissipation can result fromsimultaneous shorts on all amplifiers.

Page 31: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

LM358, LM258, LM2904, LM2904A, LM2904V, NCV2904

http://onsemi.com5

ELECTRICAL CHARACTERISTICS (VCC = 5.0 V, VEE = Gnd, TA = 25°C, unless otherwise noted.)

LM2904 LM2904A LM2904V, NCV2904

Characteristic Symbol Min Typ Max Min Typ Max Min Typ Max Unit

Input Offset VoltageVCC = 5.0 V to 30 V, VIC = 0 V to VCC −1.7 V,VO 1.4 V, RS = 0

VIO mV

TA = 25°C − 2.0 7.0 − 2.0 7.0 − − 7.0TA = Thigh (Note 8) − − 10 − − 10 − − 13TA = Tlow (Note 8) − − 10 − − 10 − − 10

Average Temperature Coefficient of Input OffsetVoltage

VIO/T − 7.0 − − 7.0 − − 7.0 − V/°C

TA = Thigh to Tlow (Note 8)

Input Offset Current IIO − 5.0 50 − 5.0 50 − 5.0 50 nATA = Thigh to Tlow (Note 8) − 45 200 − 45 200 − 45 200

Input Bias Current IIB − −45 −250 − −45 −100 − −45 −250TA = Thigh to Tlow (Note 8) − −50 −500 − −50 −250 − −50 −500

Average Temperature Coefficient of Input OffsetCurrent

IIO/T − 10 − − 10 − − 10 − pA/°C

TA = Thigh to Tlow (Note 8)

Input Common Mode Voltage Range (Note 9),VCC = 30 V

VICR 0 − 24.3 0 − 24.3 0 − 24.3 V

VCC = 30 V, TA = Thigh to Tlow 0 − 24 0 − 24 0 − 24

Differential Input Voltage Range VIDR − − VCC − − VCC − − VCC V

Large Signal Open Loop Voltage Gain AVOL V/mVRL = 2.0 k, VCC = 15 V, For Large VO Swing, 25 100 − 25 100 − 25 100 −TA = Thigh to Tlow (Note 8) 15 − − 15 − − 15 − −

Channel Separation CS − −120 − − −120 − − −120 − dB1.0 kHz ≤ f ≤ 20 kHz, Input Referenced

Common Mode Rejection CMR 50 70 − 50 70 − 50 70 − dB

RS ≤ 10 k

Power Supply Rejection PSR 50 100 − 50 100 − 50 100 − dB

Output Voltage−High Limit TA = Thigh to Tlow (Note 8)

VOH V

VCC = 5.0 V, RL = 2.0 k, TA = 25°C 3.3 3.5 − 3.3 3.5 − 3.3 3.5 −VCC = 30 V, RL = 2.0 k 22 − − 22 − − 22 − −VCC = 30 V, RL = 10 k 23 24 − 23 24 − 23 24 −

Output Voltage−Low Limit VOL − 5.0 20 − 5.0 20 − 5.0 20 mVVCC = 5.0 V, RL = 10 k, TA = Thigh to Tlow (Note 8)

Output Source Current IO+ 20 40 − 20 40 − 20 40 − mAVID = +1.0 V, VCC = 15 V

Output Sink Current IO−VID = −1.0 V, VCC = 15 V 10 20 − 10 20 − 10 20 − mAVID = −1.0 V, VO = 200 mV − − − − − − − − − A

Output Short Circuit to Ground (Note 10) ISC − 40 60 − 40 60 − 40 60 mA

Power Supply Current (Total Device)TA = Thigh to Tlow (Note 8)

ICC mA

VCC = 30 V, VO = 0 V, RL = ∞ − 1.5 3.0 − 1.5 3.0 − 1.5 3.0VCC = 5 V, VO = 0 V, RL = ∞ − 0.7 1.2 − 0.7 1.2 − 0.7 1.2

8. LM258: Tlow = −25°C, Thigh = +85°C LM358: Tlow = 0°C, Thigh = +70°CLM2904/LM2904A: Tlow = −40°C, Thigh = +105°C LM2904V & NCV2904: Tlow = −40°C, Thigh = +125°CNCV2904 is qualified for automotive use.

9. The input common mode voltage or either input signal voltage should not be allowed to go negative by more than 0.3 V. The upper end ofthe common mode voltage range is VCC − 1.7 V.

10.Short circuits from the output to VCC can cause excessive heating and eventual destruction. Destructive dissipation can result fromsimultaneous shorts on all amplifiers.

Page 32: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

LM358, LM258, LM2904, LM2904A, LM2904V, NCV2904

http://onsemi.com6

CIRCUIT DESCRIPTION

The LM358 series is made using two internallycompensated, two−stage operational amplifiers. The firststage of each consists of differential input devices Q20 andQ18 with input buffer transistors Q21 and Q17 and thedifferential to single ended converter Q3 and Q4. The firststage performs not only the first stage gain function but alsoperforms the level shifting and transconductance reductionfunctions. By reducing the transconductance, a smallercompensation capacitor (only 5.0 pF) can be employed, thussaving chip area. The transconductance reduction isaccomplished by splitting the collectors of Q20 and Q18.Another feature of this input stage is that the input commonmode range can include the negative supply or ground, insingle supply operation, without saturating either the inputdevices or the differential to single−ended converter. Thesecond stage consists of a standard current source loadamplifier stage.

Each amplifier is biased from an internal−voltageregulator which has a low temperature coefficient thusgiving each amplifier good temperature characteristics aswell as excellent power supply rejection.

Figure 3. Large Signal VoltageFollower Response

5.0 s/DIV

1.0

V/D

IV

VCC = 15 VdcRL = 2.0 kTA = 25°C

AV

OL,

OP

EN

LO

OP

VO

LTA

GE

GA

IN (

dB)

V

, IN

PU

T V

OLT

AG

E (

V)

I

Figure 4. Input Voltage Range Figure 5. Large−Signal Open Loop Voltage Gain

18

16

14

12

10

8.0

6.0

4.0

2.0

0

20

0 2.0 4.0 6.0 8.0 10 12 14 16 18 20

VCC/VEE, POWER SUPPLY VOLTAGES (V)

120

100

80

60

40

20

0

−201.0 10 100 1.0 k 10 k 100 k 1.0 M

f, FREQUENCY (Hz)

Negative

Positive

VCC = 15 VVEE = GndTA = 25°C

Page 33: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

LM358, LM258, LM2904, LM2904A, LM2904V, NCV2904

http://onsemi.com7

VO

R, O

UT

PU

T V

OLT

AG

E R

AN

GE

(V

)pp

VO

, OU

TP

UT

VO

LTA

GE

(m

V)

Figure 6. Large−Signal Frequency Response Figure 7. Small Signal Voltage FollowerPulse Response (Noninverting)

Figure 8. Power Supply Current versusPower Supply Voltage

Figure 9. Input Bias Current versusSupply Voltage

14

12

10

8.0

6.0

4.0

2.0

01.0 10 100 1000

f, FREQUENCY (kHz)

550

500

450

400

350

300

250

200

00 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0

t, TIME (ms)

2.4

2.1

1.8

1.5

1.2

0.9

0.6

0.3

00 5.0 10 15 20 25 30 35

VCC, POWER SUPPLY VOLTAGE (V) VCC, POWER SUPPLY VOLTAGE (V)

90

80

700 2.0 4.0 6.0 8.0 10 12 14 16 18 20

I

, P

OW

ER

SU

PP

LY C

UR

RE

NT

(mA

)C

C I ,

INP

UT

BIA

S C

UR

RE

NT

(nA

)IB

RL = 2.0 kVCC = 15 VVEE = GndGain = −100RI = 1.0 kRF = 100 k

Input

Output

TA = 25°CRL =

VCC = 30 VVEE = GndTA = 25°CCL = 50 pF

Page 34: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

LM358, LM258, LM2904, LM2904A, LM2904V, NCV2904

http://onsemi.com8

R1

2

1R1TBP

R1 + R2

R1R1 + R2

1

eo

e1

e2

eo = C (1 + a + b) (e2 − e1)

R1a R1

b R1

R

CR

+

1/2

LM358

+

+ R

1/2LM358

+

R1

R2

VO

Vref

Vin

VOH

VO

VOL

VinL =R1

(VOL − Vref)+ Vref

VinH = (VOH − Vref) + Vref

H =R1 + R2

(VOH − VOL)R1

+

+

+

R

C

R2

R3

C1

100 kR

C

R

C1 R2

100 k

Vin

Vref

Vref

Vref

Vref

BandpassOutput

fo = 2 RCR1 = QR

R2 =

R3 = TN R2

C1 = 10 C

1

Notch Output

Vref = VCC

Hysteresis

1/2

LM358

1/2

LM358

1C R

VinL VinH

Vref

1/2

LM358

1/2

LM358 1/2

LM358 1/2

LM358

TBP = Center Frequency GainTN = Passband Notch Gain

RCR1R2R3

For:

+

foQTBPTN

= 1.0 kHz= 10= 1= 1

= 160 k= 0.001 F= 1.6 M= 1.6 M= 1.6 M

Where:

MC1403

1/2

LM358

+

R1

VCCVCC

VO

2.5 V

R2

50 k

10 kVref

Vref = VCC2

5.0 k

R C

RC

+

1/2LM358

VO

2 RC

1

For: fo = 1.0 kHzR = 16 kC = 0.01 F

VO = 2.5 V (1 +R1

R2)

1

VCC

fo =

Figure 10. Voltage Reference Figure 11. Wien Bridge Oscillator

Figure 12. High Impedance Differential Amplifier Figure 13. Comparator with Hysteresis

Figure 14. Bi−Quad Filter

Page 35: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

LM358, LM258, LM2904, LM2904A, LM2904V, NCV2904

http://onsemi.com9

21

Vref = VCC12

Figure 15. Function Generator Figure 16. Multiple Feedback Bandpass Filter

For less than 10% error from operational amplifier.

If source impedance varies, filter may be preceded with voltage

follower buffer to stabilize filter parameters.

Where fo and BW are expressed in Hz.

Qo fo

BW< 0.1

Given: fo = center frequency

A(fo) = gain at center frequency

Choose value fo, C

Then: R3 =Q

fo C

R3R1 =

2 A(fo)

R1 R3

4Q2 R1 −R3R2 =

+

+

+

Vref = VCC

Vref

f =R1 + RC

4 CRf R1R3 =

R2 R1

R2 + R1

R2

300 k

75 k

R3

R1

C

Triangle WaveOutput

SquareWaveOutput

VCC

R3R1

R2

Vref

Vin

CC

VO

COCO = 10 C

Rf

if,

1/2

LM358

Vref

1/2

LM358

1/2

LM358

100 k

Page 36: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

LM358, LM258, LM2904, LM2904A, LM2904V, NCV2904

http://onsemi.com10

ORDERING INFORMATION

Device Operating Temperature Range Package Shipping †

LM358D SOIC−8 98 Units/Rail

LM358DR2 SOIC−8 2500 Tape & Reel

LM358DR2G SOIC−8(Pb−Free)

2500 Tape & Reel

LM358DMR20°C to +70°C

Micro8 4000 Tape & Reel

LM358DMR2G0°C to +70°C

Micro8(Pb−Free)

4000 Tape & Reel

LM358N PDIP−8 50 Units/Rail

LM358NG PDIP−8(Pb−Free)

50 Units/Rail

LM258D SOIC−8 98 Units/Rail

LM258DR2 SOIC−8 2500 Tape & Reel

LM258DR2G−25°C to +85°C

SOIC−8(Pb−Free)

2500 Tape & Reel

LM258DMR2 Micro8 4000 Tape & Reel

LM258N PDIP−8 50 Units/Rail

LM2904D SOIC−8 98 Units/Rail

LM2904DR2 SOIC−8 2500 Tape & Reel

LM2904DR2G SOIC−8(Pb−Free)

2500 Tape & Reel

LM2904DMR240°C to +105°C

Micro8 2500 Tape & Reel

LM2904DMR2G−40°C to +105°C

Micro8(Pb−Free)

2500 Tape & Reel

LM2904N PDIP−8 50 Units/Rail

LM2904ADMR2 Micro8 4000 Tape & Reel

LM2904AN PDIP−8 50 Units/Rail

LM2904VD SOIC−8 98 Units/Rail

LM2904VDG SOIC−8(Pb−Free)

98 Units/Rail

LM2904VDR2 SOIC−8 2500 Tape & Reel

LM2904VDMR2 −40°C to +125°C Micro8 4000 Tape & Reel

LM2904VN PDIP−8 50 Units/Rail

NCV2904DR2* SOIC−8 2500 Tape & Reel

NCV2904DMR2* Micro8 4000 Tape & Reel

*NCV2904 is qualified for automotive use.†For information on tape and reel specifications, including part orientation and tape sizes, please refer to our Tape and Reel Packaging

Specifications Brochure, BRD8011/D.

Page 37: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

LM358, LM258, LM2904, LM2904A, LM2904V, NCV2904

http://onsemi.com11

PDIP−8N SUFFIXCASE 626

SOIC−8D SUFFIXCASE 751

MARKING DIAGRAMS

x = 2 or 3A = Assembly LocationWL, L = Wafer LotYY, Y = YearWW, W = Work Week

PDIP−8AN SUFFIXCASE 626

SOIC−8VD SUFFIXCASE 751

PDIP−8VN SUFFIXCASE 626

1

8

LMx58N AWL YYWW

1

8

LM2904AN AWL YYWW

1

8

LM2904N AWL YYWW

1

8

LM2904VN AWL YYWW

ALYWLMx58

1

8

ALYW2904

1

8

ALYW2904V

1

8

Micro8DMR2 SUFFIX

CASE 846A

x58AYW

1

8

2904AYW

1

8

904AAYW

1

8

904VAYW

1

8

*This diagram also applies to NCV2904

*

*

Page 38: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

LM358, LM258, LM2904, LM2904A, LM2904V, NCV2904

http://onsemi.com12

PACKAGE DIMENSIONS

PDIP−8N, AN, VN SUFFIX

CASE 626−05ISSUE L

NOTES:1. DIMENSION L TO CENTER OF LEAD WHEN

FORMED PARALLEL.2. PACKAGE CONTOUR OPTIONAL (ROUND OR

SQUARE CORNERS).3. DIMENSIONING AND TOLERANCING PER ANSI

Y14.5M, 1982.

1 4

58

F

NOTE 2 −A−

−B−

−T−SEATING

PLANE

H

J

G

D K

N

C

L

M

MAM0.13 (0.005) B MT

DIM MIN MAX MIN MAX

INCHESMILLIMETERS

A 9.40 10.16 0.370 0.400

B 6.10 6.60 0.240 0.260

C 3.94 4.45 0.155 0.175

D 0.38 0.51 0.015 0.020

F 1.02 1.78 0.040 0.070

G 2.54 BSC 0.100 BSC

H 0.76 1.27 0.030 0.050

J 0.20 0.30 0.008 0.012

K 2.92 3.43 0.115 0.135

L 7.62 BSC 0.300 BSC

M −−− 10 −−− 10

N 0.76 1.01 0.030 0.040

Page 39: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

LM358, LM258, LM2904, LM2904A, LM2904V, NCV2904

http://onsemi.com13

PACKAGE DIMENSIONS

SOIC−8D, VD SUFFIXCASE 751−07

ISSUE AB

1.520.060

7.00.275

0.60.024

1.2700.050

4.00.155

mminches

SCALE 6:1

*For additional information on our Pb−Free strategy and solderingdetails, please download the ON Semiconductor Soldering andMounting Techniques Reference Manual, SOLDERRM/D.

SOLDERING FOOTPRINT*

SEATINGPLANE

1

4

58

N

J

X 45

K

NOTES:1. DIMENSIONING AND TOLERANCING PER

ANSI Y14.5M, 1982.2. CONTROLLING DIMENSION: MILLIMETER.3. DIMENSION A AND B DO NOT INCLUDE

MOLD PROTRUSION.4. MAXIMUM MOLD PROTRUSION 0.15 (0.006)

PER SIDE.5. DIMENSION D DOES NOT INCLUDE DAMBAR

PROTRUSION. ALLOWABLE DAMBARPROTRUSION SHALL BE 0.127 (0.005) TOTALIN EXCESS OF THE D DIMENSION ATMAXIMUM MATERIAL CONDITION.

6. 751−01 THRU 751−06 ARE OBSOLETE. NEWSTANDARD IS 751−07.

A

B S

DH

C

0.10 (0.004)

DIMA

MIN MAX MIN MAXINCHES

4.80 5.00 0.189 0.197

MILLIMETERS

B 3.80 4.00 0.150 0.157C 1.35 1.75 0.053 0.069D 0.33 0.51 0.013 0.020G 1.27 BSC 0.050 BSCH 0.10 0.25 0.004 0.010J 0.19 0.25 0.007 0.010K 0.40 1.27 0.016 0.050M 0 8 0 8 N 0.25 0.50 0.010 0.020S 5.80 6.20 0.228 0.244

−X−

−Y−

G

MYM0.25 (0.010)

−Z−

YM0.25 (0.010) Z S X S

M

Page 40: Foto 1 : Bagian Atas dari Alat · The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five vector

LM358, LM258, LM2904, LM2904A, LM2904V, NCV2904

http://onsemi.com14

PACKAGE DIMENSIONS

Micro8DMR2 SUFFIXCASE 846A−02

ISSUE F

SBM0.08 (0.003) A STDIM MIN MAX MIN MAX

INCHESMILLIMETERS

A 2.90 3.10 0.114 0.122

B 2.90 3.10 0.114 0.122

C −−− 1.10 −−− 0.043

D 0.25 0.40 0.010 0.016

G 0.65 BSC 0.026 BSC

H 0.05 0.15 0.002 0.006

J 0.13 0.23 0.005 0.009

K 4.75 5.05 0.187 0.199

L 0.40 0.70 0.016 0.028

NOTES:1. DIMENSIONING AND TOLERANCING PER ANSI

Y14.5M, 1982.2. CONTROLLING DIMENSION: MILLIMETER.3. DIMENSION A DOES NOT INCLUDE MOLD FLASH,

PROTRUSIONS OR GATE BURRS. MOLD FLASH,PROTRUSIONS OR GATE BURRS SHALL NOTEXCEED 0.15 (0.006) PER SIDE.

4. DIMENSION B DOES NOT INCLUDE INTERLEADFLASH OR PROTRUSION. INTERLEAD FLASH ORPROTRUSION SHALL NOT EXCEED 0.25 (0.010)PER SIDE.

5. 846A−01 OBSOLETE, NEW STANDARD 846A−02.

−B−

−A−

D

K

GPIN 1 ID

8 PL

0.038 (0.0015)

−T−SEATING

PLANE

C

H J L

8X 8X

6X mminches

SCALE 8:1

1.040.041

0.380.015

5.280.208

4.240.167

3.200.126

0.650.0256

*For additional information on our Pb−Free strategy and solderingdetails, please download the ON Semiconductor Soldering andMounting Techniques Reference Manual, SOLDERRM/D.

SOLDERING FOOTPRINT*

ON Semiconductor and are registered trademarks of Semiconductor Components Industries, LLC (SCILLC). SCILLC reserves the right to make changes without further noticeto any products herein. SCILLC makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does SCILLC assume any liabilityarising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation special, consequential or incidental damages.“Typical” parameters which may be provided in SCILLC data sheets and/or specifications can and do vary in different applications and actual performance may vary over time. Alloperating parameters, including “Typicals” must be validated for each customer application by customer’s technical experts. SCILLC does not convey any license under its patent rightsnor the rights of others. SCILLC products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applicationsintended to support or sustain life, or for any other application in which the failure of the SCILLC product could create a situation where personal injury or death may occur. ShouldBuyer purchase or use SCILLC products for any such unintended or unauthorized application, Buyer shall indemnify and hold SCILLC and its officers, employees, subsidiaries, affiliates,and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or deathassociated with such unintended or unauthorized use, even if such claim alleges that SCILLC was negligent regarding the design or manufacture of the part. SCILLC is an EqualOpportunity/Affirmative Action Employer. This literature is subject to all applicable copyright laws and is not for resale in any manner.

PUBLICATION ORDERING INFORMATIONN. American Technical Support : 800−282−9855 Toll FreeUSA/Canada

Japan : ON Semiconductor, Japan Customer Focus Center2−9−1 Kamimeguro, Meguro−ku, Tokyo, Japan 153−0051Phone : 81−3−5773−3850

LM358/D

Micro8 is a trademark of International Rectifier.

LITERATURE FULFILLMENT :Literature Distribution Center for ON SemiconductorP.O. Box 61312, Phoenix, Arizona 85082−1312 USAPhone : 480−829−7710 or 800−344−3860 Toll Free USA/CanadaFax: 480−829−7709 or 800−344−3867 Toll Free USA/CanadaEmail : [email protected]

ON Semiconductor Website : http://onsemi.com

Order Literature : http://www.onsemi.com/litorder

For additional information, please contact yourlocal Sales Representative.