Sie sind auf Seite 1von 8

ALTERNATE FUNCTIONS OF PORT 3 PINS

BIT P3.0 P3.1 P3.2 P3.3 P3.4 P3.5 P3.6 P3.7


3/28/12

NAME RXD TXD INT0 INT1 T0 T1 WR RD

ALTERNATE FUNCTION Receive data (serial port) Transmit data (serial port) External interrupt 0 External interrupt 1 Timer/counter 0 external input Timer/counter 1 external input External data memory write strobe External data memory read strobe

TIMER OPERATION
Timer Mode Register (TMOD) Bit Name 7 6 5 4 3 2 1 0 GATE C/T M1 M0 GATE C/T M1 M0 1 1 Timer Description 1 When set, timer runs only if INT1 is high 1 Counter(1) / timer(0) select bit Mode bit 1 Mode bit 0 0 When set, timer runs only if INT0 is high 0 Counter(1) / timer(0) select bit 0 Mode bit 1 0 Mode bit 0

3/28/12

TIMER OPERATION
Timer Control Register (TCON) Bit Symbol Bit-address Description TF1 8FH Timer 1 overflow flag. Set by h/w whenever counter overflows. Reset by s/w, or by h/w when processor vectors to an ISR. TCON.7 TCON.6 TCON.5 TCON.4 TR1 8EH TF0 8DH TR0 8CH Timer 1 run control bit. Set or reset by s/w to start/stop counter. Timer 0 overflow flag. Timer 0 run control bit.

3/28/12

TIMER OPERATION
Timer Control Register .. continued Bit Symbol IE1 Bit-address 8BH Description TCON.3 External interrupt 1 edge flag.Set by h/w when a falling edge is detected on INT1. Cleared by s/w, or by h/w when processor vectors to an ISR. 8AH External interrupt 1 type flag. Set/cleared by s/w for fallingedge/low-level activated external interrupt. IT1 IE0 IT0 89H 88H External interrupt 0 edge flag. External interrupt 0 type flag.

TCON.2

TCON.1 TCON.0

3/28/12

INTERRUPTS
Interrupt Enable Register Bit Symbol IE.7 EA IE.6 IE.5 IE.4 ES IE.3 ET1 IE.2 EX1 IE.1 ET0 IE.0 EX0 AEH ACH ABH AAH A9H A8H Bit-Address AFH ADH Description (1 = Enable) Global enable/disable Undefined Enable serial port interrupt Enable timer 1 interrupt Enable external 1 interrupt Enable timer 0 interrupt Enable external 0 interrupt

Undefined

3/28/12

INTERRUPTS
Interrupt Priority Register Bit Symbol IP.7 IP.6 IP.5 IP.4 PS IP.3 PT1 IP.2 PX1 IP.1 PT0 IP.0 PX0 Bit-Address BFH BEH BDH BCH BBH BAH B9H B8H Description (1 = Higher Priority) Undefined Undefined Undefined Priority for serial port interrupt Priority for timer 1 interrupt Priority for external 1 interrupt Priority for timer 0 interrupt Priority for external 0 interrupt

3/28/12

Serial Port
Serial Port Mode setting The 8051 serial port has four modes of operation that can be set by writing 1s and 0s to the SCON.7 (SM0) and SCON.6 (SM1) bits. The first mode implements a simple shift register and the other three modes enables asynchronous serial communication. Serial Port Modes: SM0 0 0 1 1 1 SM1 0 1 0 3 MODE 0 1 2 DESCRIPTION 8-bit UART 9-bit UART 9-bit UART BAUD RATE Variable (set by T1) Fixed (Osc. Fq./32 or/64) Variable (set by T1) Shift Register Fixed (Osc. Fq. / 12)

3/28/12

Serial Port
SCON Register Summery BIT SYMBOL ADDRESS DESCRIPTION

SCON.7 SCON.6 SCON.5 2 SCON.4 SCON.3 UART) SCON.2 UART)

SMO SM1 SM3 REN TB8 RB8

9FH 9EH 9DH 9CH 9BH 9AH 99H

Serial port mode bit 0 Serial port mode bit 1 Serial port mode bit Receiver Enable Transmit bit 8 (9-bit Receive bit 8 (9-bit Transmit interrupt flag.

SCON.1 TI Set at end of


3/28/12 SCON.0

character transmission. Cleared by S/W. RI 98H Receive interrupt flag.

Das könnte Ihnen auch gefallen