Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
http://idgs.in/188257
  1. #16
    -GajahLampung-'s Avatar
    Join Date
    Nov 2008
    Location
    Penangkaran Gajah
    Posts
    1,069
    Points
    1,449.20
    Thanks: 0 / 4 / 4

    Default

    ini nemu dari forum luar semoga bermanfaat

    INTRODUCTION TO MICRO CONTROLLERS(8051)

    Microprocessors and micro controller stem from the same idea, are made by the same people, and are sold to the same types same types of system designers and programmers.

    Microprocessor's the term has come to be knows to be known is a general-purpose Digital computer central processing unit (CPU). To make the Microprocessor a complete micro computer, one must add memory, usually read-only program memory (ROM) and read and write memory, memory decoders, an oscillator, and a number of input/output devices such parallel and serial data ports. To communicate with external world it needs to have some additional circuitry.

    Micro controller, which is a true computer on a chip. The design incorporates all of the features found in a microprocessor CPU: ALU, PC, SP, and registers. It has also has added the other features need make a complete computer. ROM, RAM, parallel I/O, Serial I/O, counters, and a clock circuitry.

    To summarize, the microprocessor is concerned with rapid movement of code and data from external addresses to the chip; the micro controller is concerned with rapid movement of bits within the chip. The microcontrollercan function as a computer with addition of no external digital parts; the microprocessor must have man additional parts to be operational.

    Micro controllers are available in N-Channel Metal Oxide Silicon (NMOS) and Complementary Metal Oxide Silicon (CMOS) construction in variety of package types. They are ranging from 8031 to 8751.


    Micro controller Features are: -

    1. Internal ROM and RAM
    2. I/O Ports with programmable pins
    3. Timers and Counters
    4. Serial Data Communication



    The 8051 Architecture consists of these specific features:-

    1. Eight-bit CPU with registers A (the accumulator) and B
    2. Sixteen-bit Program Counter (PC) and Data pointer (DPTR).
    3. Eight-bit Program Status Word (PSW).
    4. Eight -bit Stack Pointer (SP).
    5. Internal ROM or EPROM (8751) of (8031) to 4k (8051).
    6. Internal RAM of 128 bytes.
    a. Four register banks, each containing eight registers.
    b. Sixteen bytes, which may be addressed at the bit level.
    c. Eighty bytes of general-purpose data memory.
    7. Thirty-two input/output pins arranged as four 8-bit ports: P0 - P3.
    8. Two 16 bit Timers/Counters: T0 and T1.
    9. Full duplex serial data Receiver/Transmitter: SBUF.
    10. Control registers: TCON, TMOD, SCON, PCON, IP and IE.
    11. Two external and three internal interrupt sources.
    12. Oscillator and clock circuits.

    8051 is a collection of 8 and 16 bit registers and 8 bit memory locations. These registers and memory locations can be made to operate using the software instructions.

    The program instructions control the registers and digital data paths that are contained inside the 8051,as well as memory locations that are located outside the 8051.

    Micro controller is same as Microcomputer but there is some special purpose registers. Most of registers have specific function. They are specify by symbolic name, such as A or TH0 or PC.

    Each register has an internal 1-byte address assigned to it. Some registers are both byte and bit addressable. That is, the entire byte of data or bit s at such register address may be read or altered.

    Software instructions are generally able to specify a register by its address, its symbolic name or both. Many of the pins are used for more than one function. Not at the same time.


    LIST OF SPECIAL FUNCTION REGISTERS IN 8051:-

    SYMBOL REGISTER ADDRESS BIT ADDRESSABLE RESET

    ACC Accumulator E0h Yes (Function) 00h

    B B register F0h Yes (Function) 00h

    DPTR Data Pointer
    DPH Data Pointer high 83h 00h
    DPL Data Pointer low 82h 00h

    IE Interrupt enables A8h Yes (Function) 0x000000B
    IP Interrupt priority B8h Yes (Function) xx000000B
    P0 Port 0 80h Yes (Function) FFh
    P1 Port 1 90h Yes (Function) FFh
    P2 Port 2 A0h Yes (Function) FFh
    P3 Port 3 B0h Yes (Function) FFh

    PCON Power control 87h (Function) 0xxxxxxxB
    PSW Pgm status word D0h Yes (Function) 00h
    SBUF Serial data buffer 99h xxxxxxxxB
    SCON Serial controller 98h Yes (Function) 00h

    SP Stack pointer 81h 07h

    TCON Timer control 88h Yes (Function)
    TH0 Timer high 0 8Ch 00h
    TH1 Timer high 1 8Dh 00h

    TL0 Timer low 0 8Ah 00h
    TL1 Timer low 1 8Bh 00h

    TMOD Timer mode 89h (Function) 00h

    Port 1: (#1-#8) Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. Port 1 pins that have 1s written to them are pulled high by the internal pull-ups, and in that state can be used as inputs. As inputs, port 1 pins that are externally being pulled low will source current because of the internal pull-ups.

    RST: (#9) Reset. A high on this pin for two machine cycles while the oscillator is running, resets the device. An internal diffused resistor to Vss permits a power-on reset using only an external capacitor to Vcc.

    Port 3: (#10-#17) Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. It also serves the functions of various special features of the 80C51 Family as follows:

    Port Pin Pin # Alternate Function

    P3.0 10 RXD (serial input port)
    P3.1 11 TXD (serial output port)
    P3.2 12 INT0\ (external interrupt 0)
    P3.3 13 INT1\ (external interrupt 1)
    P3.4 14 T0 (timer 0 external input)
    P3.5 15 T1 (timer 1 external input)
    P3.6 16 WR\ (external data memory write strobe)
    P3.7 17 RD\ (external data memory read strobe)

    XTAL2: (#18) Output from the inverting oscillator amplifier.

    XTAL1#19) Input to the inverting oscillator amplifier.

    Vss: (#20) Circuit ground potential

    Port 2: (#21-#28) Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. Port 2 emits the high-order address byte during accesses to external memory that use
    16-bit addresses. In this application, it uses the strong internal pullups when emitting 1s. More About the Ports

    pSEN\#29) Program Store Enable is the read strobe to external Program Memory.

    ALE/PROG#30) Address Latch Enable output pulse for latching the low byte of the address during accesses to external memory. ALE is emitted at a constant rate of 1/6 of the oscillator frequency, for external timing or clocking purposes, even when there are no accesses to external memory. (However, one ALE pulse is skipped during each access to external Data Memory.) This pin is also the program pulse input (PROG) during EPROM programming.

    EA\ /Vpp: (#31) When EA\ is held high the CPU executes out of internal Program Memory (unless the Program Counter exceeds 0FFFh in the 80C51). Holding EA\ low forces the CPU to execute out of external memory regardless of the Program counter value. In the 80C31, EA\ must be externally wired low. In the EPROM devices, this pin also receives the programming supply voltage (Vpp) during EPROM programming.

    Port 0: (#39-#32) Port 0 is an 8-bit open drain bi-directional port. As an open drain output port, it can sink eight LS TTL loads. Port 0 pins that have 1s written to them float, and in that state will function as high impedance inputs. Port 0 is also the multiplexed low-order address and data bus during accesses to external memory. In this application it uses strong internal pull-ups when emitting 1s. Port 0 emits code bytes during program verification. In this application, external pull-ups are required.

    Vcc: (#40) Supply Voltage.

    TIMERS AND COUNTERS:-

    The 80C51 has two 16-bit Timer/Counter registers: Timer 0 and Timer 1. Both can be configured to operate either as timers or event counters. In addition to the "Timer" or "Counter" selection, Timer 0 and Timer 1 have four operating modes from which to select.

    Timer 0 & Timer 1:-
    Control bits C/T in the Special Function Register TMOD select the "Timer" or "Counter" function. These two Timer/Counters have four operating modes, which are selected by bit-pairs (M1,M0) in TMOD. Modes 0, 1, and 2 are the same for both Timers/Counters. Mode 3 is different.
    Mode 0:-
    In this mode, the Timer register is configured as a 13-bit register. As the count rolls over from all 1s to all 0s, it sets the Timer interrupt flag TFx. The counted input is enabled to the Timer when TRx=1 and either GATE=0 or INTx\=1. Rx is a control bit in the Special Function Register TCON. GATE is in TMOD.
    The 13-bit register consists of all 8 bits of THX and the lower 5 bits of TLx. The upper 3 bits of TLx are indeterminate and should be ignored.

    Mode 1:-
    Mode 1 is the same as Mode 0, except that the Timer register is being run with all 16 bits.

    Mode 2:-
    Mode 2 configures the Timer register as an 8-bit Counter (TLx) with automatic reload. Overflow from TLx not only sets TFx, but also reloads TLx with the contents of THx, which is preset by software. The reload leaves THx unchanged.
    Mode 2 operation is the same for both Timer/Counters.

    Mode 3:-
    Timer 1 in Mode 3 simply holds its count. The effect is the same as setting TR1=0.Timer 0 in Mode 3 establishes TL0 and TH0 as two separate counters. TL0 uses the Timer 0 control bits: C/T, GATE, TR0, INT0, and TF0. TH0 is locked into a timer function (counting machine cycles) and takes over the use of TR1 and TF1 from Timer 1. Thus, TH0 now controls the "Timer 1" interrupt.
    Mode 3 is provided for applications requiring an extra 8-bit timer on the counter. With Timer 0 in Mode 3, an 80C51 can look like it has three Timer/Counters. When Timer 0 is in Mode 3, Timer 1 can be turned on and off by switching it out of and into its own Mode 3, or can still be used by the serial port as a baud rate generator, or in fact, in any application not requiring an interrupt.

    DETAILS ABOUT SFR'S
    USED FOR TIMER/COUNTER MANIPULATIONS:-


    TCON: Timer/Counter Control Register. Bit Addressable.



    TF1 Timer 1 overflow flag. Set by hardware when the Timer/Counter 1
    overflows. Cleared by hardware as processor vectors to the interrupt
    service routine.
    TR1 Timer 1 run control bit. Set/cleared by software to turn Timer/Counter 1 ON/OFF.
    TF0 Timer 0 overflow flag. Set by hardware when the Timer/Counter 0 overflows. Cleared by hardware as processor vectors to the service routine.
    TR0 Timer 0 run control bit. Set/cleared by software to turn Timer/Counter 0 ON/OFF.




    IE1 External Interrupt 1 edge flag. Set by hardware when External Interrupt edge
    Is ducted. Cleared by hardware when interrupt is processed.
    IT1 Interrupt 1 type control bit. Set/cleared by software to specify falling edge/low level triggered External Interrupt.
    IE0 External Interrupt 0 edge flag. Set by hardware when External Interrupt edge
    Is detected. Cleared by hardware when interrupt is processed.
    IT0 Interrupt 0-type control bit. Set/cleared by software to specify falling
    edge/low level triggered External Interrupt.

    TMOD: Timer/Counter Mode Control Register. Not Bit Addressable.


    Timer 1 Timer 0


    GATE When TRx (in TCON) is set and GATE=1, Timer/CounterX will run
    only while INTx pin is high (hardware control). When GATE=0, Timer/CounterX will run only while TRx=1 (software control).
    C/T Timer or Counter selector. Cleared for Timer operation (input from internal system clock). Set for Counter operation
    (input from TX input pin).
    M1 Mode selector bit.
    M0 Mode selector bit.

    M1 M0 Mode Operating Mode
    0 0 0 13-bit Timer (8048 compatible)
    0 1 1 16-bit Timer/Counter
    1 0 2 8-bit Auto-Reload Timer/Counter
    1 1 3 (Timer 0) TL0 is an 8-bit Timer/Counter controlled by the standard Timer 0 control bits. TH0 is an 8-bit Timer
    And is controlled by Timer 1 control bits.
    1 1 3 (Timer 1) Timer/Counter 1 stopped.
    SERIAL PORT SET-UP IN 8051: -

    The serial port is full duplex, meaning it can transmit and receive simultaneously. It is also receive-buffered, meaning it can commence reception of a second byte before a previously received byte has been read from the register. (However, if the first byte still hasn't been read by the time reception of the second byte is complete, one of the bytes will be lost.) The serial port receive and transmit registers are both accessed at Special Function Register SBUF. Writing to SBUF loads the transmit register, and reading SBUF accesses a physically separate receive register.






    DATA TRANSMISSION: -

    Transmission of serial data bits begins anytime data is written to sbuf. " TI " (SCON) set to 1 when data has been transmitted and signifies that " SBUF " is empty and that another data byte can be sent.

    DATA RECEPTION: -

    Reception of serial data will begin if the receive enable bit (REN) in SCON is set to ' 1 ' for all modes. For mode ' 0 ' only RI must be cleared to 0. Receiver interrupt flag ' RI ' (in SCON) is set after data has been received in all modes. Setting of
    ' REN ' bit is a direct program control that limits the reception of unexpected data.

    The serial port can operate in 4 modes:

    Mode 0: -
    Serial data enters and exits through RXD. TXD output the shift clock. 8 bits are transmitted/received (LSB first). The baud rate is fixed at 1/12 the oscillator frequency.
    Mode 1:-
    10 bits are transmitted (through TxD) or received (through RxD): a start bit (0), 8 data bits (LSB first), and a stop bit (1). On receive, the stop bit goes into RB8 in Special Function Register SCON. The baud rate is variable.

    Mode 2:
    11 bits are transmitted (through TXD) or received (through RXD): start bit (0), 8 data bits (LSB first), a programmable 9th data bit, and a stop bit (1). On Transmit, the 9th data bit (TB8 in SCON) can be assigned the value of 0 or 1. Or, for example, the parity bit (P, in the PSW) could be moved into TB8. On receive the 9th data bit goes into RB8 in Special Function Register SCON, while the stop bit is ignored. The baud rate is programmable to either 1/32 or 1/64 the oscillator frequency.

    Mode 3:11 bits are transmitted (through TxD) or received (through RxD): a start bit (0), 8 data bits (LSB first), a programmable 9th data bit, and a stop bit (1). In fact, Mode 3 is the same as Mode 2 in all aspects except baud rate. The baud rate in Mode 3 is variable

    sumber:http://mcuprogramming.com/forum

  2. Hot Ad
  3. #17

    Join Date
    Nov 2006
    Location
    Bandung
    Posts
    3,016
    Points
    2,576.15
    Thanks: 1 / 9 / 9

    Default

    Quote Originally Posted by bayu_Luc1f3r View Post
    wa fer
    2 minggu ini gw baru belajar ngontrol nyala lampu sama tampilan lcd. seru bro.uas gw juga gituan. susah nih.
    perkembangan lo gmn?
    huahuahauahua mau gw ngontrol tampilan lcd kalo pake led wa bisa ....

    plis pm wa ^^

  4. #18
    bayu_Luc1f3r's Avatar
    Join Date
    Sep 2007
    Location
    Pamulang headquarter!!!
    Posts
    3,830
    Points
    1,004.19
    Thanks: 47 / 29 / 18

    Default

    ngontrol tampilan lcd bisa. led jg bisa dikit.
    pm ? mo ngapain?
    SPADEJACK
    "They Drain My Heart, and Made a SPADE"

  5. #19

    Join Date
    Nov 2006
    Location
    Bandung
    Posts
    3,016
    Points
    2,576.15
    Thanks: 1 / 9 / 9

    Default

    Pm listingnya heheh mo kalibrasi sensor pake LCD dan LED ^^

  6. #20
    bayu_Luc1f3r's Avatar
    Join Date
    Sep 2007
    Location
    Pamulang headquarter!!!
    Posts
    3,830
    Points
    1,004.19
    Thanks: 47 / 29 / 18

    Default

    ADC ya? duh agak susah tuh. kmaren baru blajar tp ga gitu ngerti. kalo gw kmaren sensor jarak.
    susahnya waktu nampilin nilai yg diperoleh dari analog ke angka digitalnya. logicnya masi ga ngerti. tp bisa coba dibahas d.

    jadi gini. gw kmaren pake chip atmega16.
    sensornya ga ngerti jenis apaan yg jelas merknya sharp.
    kluaran angka dari ADCnya itu sbanyak 1023 bit kalo ga salah. nah itu di convert ke digital berupa float.
    SPADEJACK
    "They Drain My Heart, and Made a SPADE"

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •