8051 serial port programming in assembly




















Answers: 1. True 2. Pins 10 and Pin 10 is for TxD and pin 11 for RxD. It does not need the four capacitors that MAX must have. Which timer of the is used to set the baud rate? No comments:. Newer Post Older Post Home. When a high pulse is applied to this pin, the microcontroller will reset and terminate all activities.

This is called power-on reset. All values given in the above table register will be lost upon power-on reset. This means that we must place the first line of source code in ROM location 0 because that is where the CPU wakes up and expects to find the first instruction.

The two ways of connecting the RST pin to the power-on reset circuitry is diagrammed below. The high pulse must be high for a minimum of 2 machine cycles before it is allowed to go low.

EA pin is pin This pin must be connected to to either Vcc or ground. EA pin cannot be left unconnected. In case of and microcontrollers, this pin is connected to GND. Connected EA pin to ground indicates that the code is stores externally.

This pin number of this pin is When connecting an to an external ROM or memory, Port 0 provides both the address and data. The multiplexes address and data through Port 0 to save pins. There are four ports in microcontroller named as P0, P1, P2 and P3. For Port 0 8 pins names as P0. To use all these ports as an input port, it must be programmed. Port 0 has 8 pins P0. This port can be used for input or output. Each pin of the port 0 must be connected externally to a 10K Ohm pull-up resistor, to use Port 0 as both input or output ports.

Serial communication requires that both transmitter and receiver are in sync. The has its own baud rate generator and requires the use of one of the two timer modules. Here are the bits of this register:. The register is divided into two parts, depending on which timer we will use. For this tutorial, we will be using Timer 1. Hence, our concern is only the high byte of TMOD.

We are selecting Mode 2; we set bit M1, and clear bit M0. More on this mode later below. First eight bits are the data received and 9 th bit received will be placed in RB8. TI: Transmit Interrupt flag Set by hardware when a byte is transmitted completely. Now the port is free and ready to send the next byte.

This bit must be cleared by software. RI: Receive Interrupt flag Set by hardware when a byte has been completely received. This lets the program to know that it needs to read the value quickly before another byte is read.

The Upper four bits are configuration bits. SM0 and SM1 set the serial mode between 0 and 3. The four modes along with the baud rates are in the table given below.

In modes 0 and 2 the baud rate is fixed which is based on the oscillator frequency. In modes 1 and 3 the baud rate is variable which depends on how often Timer 1 overflows. SM2 is a flag bit for Multiprocessor communication. By this way, program knows that a byte has been received and it needs to be processed. If 9th bit is clear, the RI flag will never be set. We will clear this RI bit so that the flag is set upon reception of any character.

REN is Receiver Enable bit. Set this bit if we want to receive data through serial port. It is defined as number of bits transmitted or received per second and is usually expressed in Bits per second bps. After setting the operation mode of serial port, the program must configure the serial ports baud rate which is only applicable to Serial Port modes 1 and 3.

For mode 0 and 2 oscillator frequency determines the Baud Rate. Baud rate is always the oscillator frequency divided by



0コメント

  • 1000 / 1000